Add a parameter to the createActionSet method.

This commit is contained in:
Kui LIU
2017-07-31 11:01:06 +02:00
parent 9fa6bae24c
commit 60a8858952
@@ -37,12 +37,12 @@ public class HierarchicalRegrouper {
for(Action act : actions){ for(Action act : actions){
Action parentAct = findParentAction(act, actions); Action parentAct = findParentAction(act, actions);
if (parentAct == null) { if (parentAct == null) {
actionSet = createActionSet(act, parentAct); actionSet = createActionSet(act, parentAct, null);
actionSets.add(actionSet); actionSets.add(actionSet);
} else { } else {
if (!addToAactionSet(act, parentAct, actionSets)) { if (!addToAactionSet(act, parentAct, actionSets)) {
// The index of the parent action in the actions' list is larger than the index of this action. // The index of the parent action in the actions' list is larger than the index of this action.
actionSet = createActionSet(act, parentAct); actionSet = createActionSet(act, parentAct, null);
actionSets.add(actionSet); actionSets.add(actionSet);
} }
} }
@@ -63,13 +63,13 @@ public class HierarchicalRegrouper {
return reActionSets; return reActionSets;
} }
private HierarchicalActionSet createActionSet(Action act, Action parentAct) { private HierarchicalActionSet createActionSet(Action act, Action parentAct, HierarchicalActionSet parent) {
HierarchicalActionSet actionSet = new HierarchicalActionSet(); HierarchicalActionSet actionSet = new HierarchicalActionSet();
actionSet.setAction(act); actionSet.setAction(act);
actionSet.setActionString(parseAction(act.toString())); actionSet.setActionString(parseAction(act.toString()));
actionSet.setParentAction(parentAct); actionSet.setParentAction(parentAct);
actionSet.setNode(act.getNode()); actionSet.setNode(act.getNode());
actionSet.setParent(null); actionSet.setParent(parent);
return actionSet; return actionSet;
} }
@@ -124,8 +124,7 @@ public class HierarchicalRegrouper {
continue; continue;
} }
HierarchicalActionSet actSet = createActionSet(act, actionSet.getAction()); HierarchicalActionSet actSet = createActionSet(act, actionSet.getAction(), actionSet);
actSet.setParent(actionSet);
actionSet.getSubActions().add(actSet); actionSet.getSubActions().add(actSet);
return true; return true;
} else { } else {