GraphTargetItem.src is readonly (field is private, getter added)

This commit is contained in:
honfika@gmail.com
2015-07-09 10:51:04 +02:00
parent 0437e95b4f
commit 42a8fc4c22
46 changed files with 167 additions and 152 deletions

View File

@@ -52,8 +52,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
@@ -572,7 +570,7 @@ public class Graph {
if (!forFirstCommands.isEmpty() || !forFinalCommands.isEmpty()) {
GraphTargetItem lastExpr = whi.expression.remove(whi.expression.size() - 1);
forFirstCommands.addAll(whi.expression);
list.set(i, new ForItem(whi.src, whi.loop, forFirstCommands, lastExpr, forFinalCommands, whi.commands));
list.set(i, new ForItem(whi.getSrc(), whi.loop, forFirstCommands, lastExpr, forFinalCommands, whi.commands));
}
}
}
@@ -1846,9 +1844,9 @@ public class Graph {
checkContinueAtTheEnd(finalComm, currentLoop);
}
if (!finalComm.isEmpty()) {
ret.add(index, li = new ForItem(expr.src, currentLoop, new ArrayList<>(), exprList.get(exprList.size() - 1), finalComm, commands));
ret.add(index, li = new ForItem(expr.getSrc(), currentLoop, new ArrayList<>(), exprList.get(exprList.size() - 1), finalComm, commands));
} else {
ret.add(index, li = new WhileItem(expr.src, currentLoop, exprList, commands));
ret.add(index, li = new WhileItem(expr.getSrc(), currentLoop, exprList, commands));
}
loopTypeFound = true;

View File

@@ -70,7 +70,7 @@ public abstract class GraphTargetItem implements Serializable, Cloneable {
public static final int NOPRECEDENCE = 16;
public GraphSourceItem src;
private GraphSourceItem src;
public int pos = -1;
@@ -118,6 +118,18 @@ public abstract class GraphTargetItem implements Serializable, Cloneable {
this.precedence = precedence;
}
public GraphSourceItem getSrc() {
return src;
}
protected HighlightData getSrcData() {
if (srcData == null) {
srcData = new HighlightData();
}
return srcData;
}
public List<GraphSourceItemPos> getNeededSources() {
List<GraphSourceItemPos> ret = new ArrayList<>();
ret.add(new GraphSourceItemPos(src, pos));
@@ -313,12 +325,4 @@ public abstract class GraphTargetItem implements Serializable, Cloneable {
public GraphTargetItem invert(GraphSourceItem src) {
return new NotItem(src, this);
}
protected HighlightData getSrcData() {
if (srcData == null) {
srcData = new HighlightData();
}
return srcData;
}
}

View File

@@ -26,7 +26,7 @@ import com.jpexs.decompiler.graph.GraphTargetItem;
public class PushItem extends GraphTargetItem {
public PushItem(GraphTargetItem val) {
super(val.src, val.getPrecedence());
super(val.getSrc(), val.getPrecedence());
this.value = val;
}