mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-05-25 12:26:35 +00:00
Stack handling improved - no more StackEmptyException
And/Or handling improved Preprocessor instructions introduced - §§pop,§§push...
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user