Stack handling improved - no more StackEmptyException

And/Or handling improved
Preprocessor instructions introduced - §§pop,§§push...
This commit is contained in:
Jindra Petřík
2015-06-03 10:10:44 +02:00
parent 8e770dad9f
commit cac19d6cb9
84 changed files with 11171 additions and 11238 deletions

View File

@@ -16,11 +16,51 @@
*/
package com.jpexs.decompiler.graph;
import com.jpexs.decompiler.graph.model.PopItem;
import java.util.Stack;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author JPEXS
*/
public class TranslateStack extends Stack<GraphTargetItem> {
private static PopItem pop = new PopItem(null);
private String path;
public TranslateStack(String path) {
this.path = path;
}
public String getPath() {
return path;
}
@Override
public synchronized GraphTargetItem peek() {
if (path != null) {
if (this.isEmpty()) {
Logger.getLogger(TranslateStack.class.getName()).log(Level.FINE, "{0}: Attemp to Peek empty stack", path);
return pop;
}
}
return super.peek();
}
@Override
public synchronized GraphTargetItem pop() {
if (path != null) {
if (this.isEmpty()) {
PopItem oldpop = pop;
pop = new PopItem(null);
Logger.getLogger(TranslateStack.class.getName()).log(Level.FINE, "{0}: Attemp to Pop empty stack", path);
return oldpop;
}
}
return super.pop();
}
}