mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-26 20:15:35 +00:00
Multi thread AS search
This commit is contained in:
69
libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/cache/AS2Cache.java
vendored
Normal file
69
libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/cache/AS2Cache.java
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2016 JPEXS, All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.cache;
|
||||
|
||||
import com.jpexs.decompiler.flash.action.ActionList;
|
||||
import com.jpexs.decompiler.flash.helpers.HighlightedText;
|
||||
import com.jpexs.decompiler.flash.tags.base.ASMSource;
|
||||
import com.jpexs.helpers.Cache;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class AS2Cache {
|
||||
|
||||
private final Cache<ASMSource, HighlightedText> cache = Cache.getInstance(true, false, "as2");
|
||||
|
||||
private final Cache<ASMSource, ActionList> pcodeCache = Cache.getInstance(true, true, "as2pcode");
|
||||
|
||||
public void clear() {
|
||||
pcodeCache.clear();
|
||||
cache.clear();
|
||||
}
|
||||
|
||||
public boolean isCached(ASMSource src) {
|
||||
return cache.contains(src);
|
||||
}
|
||||
|
||||
public boolean isPcodeCached(ASMSource src) {
|
||||
return pcodeCache.contains(src);
|
||||
}
|
||||
|
||||
public HighlightedText get(ASMSource src) {
|
||||
return cache.get(src);
|
||||
}
|
||||
|
||||
public ActionList getPcode(ASMSource src) {
|
||||
return pcodeCache.get(src);
|
||||
}
|
||||
|
||||
public void put(ASMSource src, HighlightedText text) {
|
||||
cache.put(src, text);
|
||||
}
|
||||
|
||||
public void put(ASMSource src, ActionList actionList) {
|
||||
pcodeCache.put(src, actionList);
|
||||
}
|
||||
|
||||
public void remove(ASMSource src) {
|
||||
if (src != null) {
|
||||
cache.remove(src);
|
||||
pcodeCache.remove(src);
|
||||
}
|
||||
}
|
||||
}
|
||||
52
libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/cache/AS3Cache.java
vendored
Normal file
52
libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/cache/AS3Cache.java
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2016 JPEXS, All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.cache;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.ScriptPack;
|
||||
import com.jpexs.decompiler.flash.helpers.HighlightedText;
|
||||
import com.jpexs.helpers.Cache;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class AS3Cache {
|
||||
|
||||
private final Cache<ScriptPack, HighlightedText> cache = Cache.getInstance(true, false, "as3");
|
||||
|
||||
public void clear() {
|
||||
cache.clear();
|
||||
}
|
||||
|
||||
public boolean isCached(ScriptPack pack) {
|
||||
return cache.contains(pack);
|
||||
}
|
||||
|
||||
public HighlightedText get(ScriptPack pack) {
|
||||
return cache.get(pack);
|
||||
}
|
||||
|
||||
public void put(ScriptPack pack, HighlightedText text) {
|
||||
cache.put(pack, text);
|
||||
}
|
||||
|
||||
public void remove(ScriptPack pack) {
|
||||
if (pack != null) {
|
||||
cache.remove(pack);
|
||||
}
|
||||
}
|
||||
}
|
||||
27
libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/cache/ScriptDecompiledListener.java
vendored
Normal file
27
libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/cache/ScriptDecompiledListener.java
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2016 JPEXS, All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.cache;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface ScriptDecompiledListener<T> {
|
||||
|
||||
public void onComplete(T result);
|
||||
}
|
||||
Reference in New Issue
Block a user