format source code

This commit is contained in:
2015-03-31 21:32:49 +02:00
parent 9813f62cdf
commit cc5f2ff4c2
18 changed files with 2245 additions and 2018 deletions
@@ -1299,16 +1299,16 @@ public class Graph {
currentLoop.phase = 0;
}
switch (part.stopPartType) {
case AND_OR:
part.setAndOrStack(stack); //Save stack for later use
break;
case AND_OR:
part.setAndOrStack(stack); //Save stack for later use
break;
case COMMONPART:
part.setCommonPartStack(stack); //Save stack for later use
break;
case COMMONPART:
part.setCommonPartStack(stack); //Save stack for later use
break;
case NONE:
break;
case NONE:
break;
}
return ret;
}
@@ -1603,7 +1603,7 @@ public class Graph {
List<GraphPart> stopPart2 = new ArrayList<>(stopPart);
GraphPart.CommonPartStack commonPartStack = null;
if ((!isEmpty) && (next != null)) {
commonPartStack=next.new CommonPartStack();
commonPartStack = next.new CommonPartStack();
if (next.commonPartStacks == null) {
next.commonPartStacks = new ArrayList<>();
}
@@ -1613,8 +1613,8 @@ public class Graph {
if (!isEmpty) {
if (next != null) {
next.commonPartStacks.add(commonPartStack);
commonPartStack.isTrueStack=true; //stopPart must know it needs to store trueStack
}
commonPartStack.isTrueStack = true; //stopPart must know it needs to store trueStack
}
onTrue = printGraph(visited, prepareBranchLocalData(localData), trueStack, allParts, part, nps.get(1), stopPart2, loops, null, staticOperation, path, recursionLevel + 1);
}
List<GraphTargetItem> onFalse = new ArrayList<>();
@@ -1626,16 +1626,16 @@ public class Graph {
onFalse = printGraph(visited, prepareBranchLocalData(localData), falseStack, allParts, part, nps.get(0), stopPart2, loops, null, staticOperation, path, recursionLevel + 1);
}
/* if there is a stopPart (next), then Graph will be further analyzed starting from the stopPart:
/* if there is a stopPart (next), then Graph will be further analyzed starting from the stopPart:
* trueStack and falseStack must be set equal to corresponding stack that was built upon reaching stopPart. */
if ((!isEmpty) && (next != null)) {
if ((commonPartStack.trueStack != null) && (commonPartStack.falseStack != null)) {
trueStack = commonPartStack.trueStack;
falseStack = commonPartStack.falseStack;
if ((commonPartStack.trueStack != null) && (commonPartStack.falseStack != null)) {
trueStack = commonPartStack.trueStack;
falseStack = commonPartStack.falseStack;
}
next.commonPartStacks.remove(next.commonPartStacks.size()-1);
next.commonPartStacks.remove(next.commonPartStacks.size() - 1);
if (next.commonPartStacks.isEmpty()) {
next.stopPartType = GraphPart.StopPartType.NONE; /* reset StopPartType */
next.stopPartType = GraphPart.StopPartType.NONE; // reset StopPartType
}
}
@@ -58,6 +58,7 @@ public class GraphPart implements Serializable {
public List<GraphPart> throwParts = new ArrayList<>();
public enum StopPartType {
NONE, AND_OR, COMMONPART
}
@@ -66,24 +67,27 @@ public class GraphPart implements Serializable {
public TranslateStack andOrStack; // Stores stack when AND_OR stopPart has been reached
public class CommonPartStack { // Stores stack when COMMONPART stopPart has been reached
boolean isTrueStack;
TranslateStack trueStack;
TranslateStack falseStack;
boolean isTrueStack;
TranslateStack trueStack;
TranslateStack falseStack;
}
public ArrayList<CommonPartStack> commonPartStacks;
public void setAndOrStack(TranslateStack stack) {
andOrStack = stack;
andOrStack = stack;
}
public void setCommonPartStack(TranslateStack stack) {
CommonPartStack currentStack = commonPartStacks.get(commonPartStacks.size()-1);
if (currentStack.isTrueStack) {
currentStack.trueStack = stack;
} else {
currentStack.falseStack = stack;
}
CommonPartStack currentStack = commonPartStacks.get(commonPartStacks.size() - 1);
if (currentStack.isTrueStack) {
currentStack.trueStack = stack;
} else {
currentStack.falseStack = stack;
}
}
public int setTime(int time, List<GraphPart> ordered, List<GraphPart> visited) {