Changeset 1107 for trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TrackBarSelectionDetectionRule.java
- Timestamp:
- 02/21/13 18:39:13 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TrackBarSelectionDetectionRule.java
r1099 r1107 19 19 * @author 2012, last modified by $Author: patrick$ 20 20 */ 21 public class TrackBarSelectionDetectionRule implements TemporalRelationshipRule { 21 class TrackBarSelectionDetectionRule implements TemporalRelationshipRule { 22 /** 23 * <p> 24 * the task tree node factory to be used for creating substructures for the temporal 25 * relationships identified during rule 26 * </p> 27 */ 28 private ITaskTreeNodeFactory taskTreeNodeFactory; 29 /** 30 * <p> 31 * the task tree builder to be used for creating substructures for the temporal relationships 32 * identified during rule application 33 * </p> 34 */ 35 private ITaskTreeBuilder taskTreeBuilder; 22 36 23 /** */ 37 /** 38 * <p> 39 * the node equality manager needed for comparing task tree nodes with each other 40 * </p> 41 */ 24 42 private NodeEqualityRuleManager nodeEqualityRuleManager; 25 43 26 44 /** 27 * 45 * <p> 46 * instantiates the rule and initializes it with a node equality rule manager and the minimal 47 * node equality identified sublist must have to consider them as iterated. 48 * </p> 28 49 */ 29 TrackBarSelectionDetectionRule(NodeEqualityRuleManager nodeEqualityRuleManager) { 30 super(); 50 TrackBarSelectionDetectionRule(NodeEqualityRuleManager nodeEqualityRuleManager, 51 ITaskTreeNodeFactory taskTreeNodeFactory, 52 ITaskTreeBuilder taskTreeBuilder) 53 { 31 54 this.nodeEqualityRuleManager = nodeEqualityRuleManager; 55 this.taskTreeNodeFactory = taskTreeNodeFactory; 56 this.taskTreeBuilder = taskTreeBuilder; 32 57 } 33 58 … … 35 60 * (non-Javadoc) 36 61 * 37 * @see TemporalRelationshipRule#apply(TaskTreeNode, TaskTreeBuilder, TaskTreeNodeFactory) 62 * @see de.ugoe.cs.tasktree.temporalrelation.TemporalRelationshipRule#apply(TaskTreeNode, 63 * boolean) 38 64 */ 39 65 @Override 40 public RuleApplicationResult apply(ITaskTreeNode parent, 41 ITaskTreeBuilder builder, 42 ITaskTreeNodeFactory nodeFactory, 43 boolean finalize) 44 { 66 public RuleApplicationResult apply(ITaskTreeNode parent, boolean finalize) { 45 67 if (!(parent instanceof ISequence)) { 46 68 return null; … … 72 94 // Therefore, 73 95 // create an iteration with the different selectable values as selection children 74 handleValueSelections (parent, currentTrackBar, valueSelectionStartIndex, index - 1,75 builder, nodeFactory, result);96 handleValueSelections 97 (parent, currentTrackBar, valueSelectionStartIndex, index - 1, result); 76 98 77 99 return result; … … 84 106 if (finalize) { 85 107 handleValueSelections(parent, currentTrackBar, valueSelectionStartIndex, 86 parent.getChildren().size() - 1, builder, nodeFactory,result);108 parent.getChildren().size() - 1, result); 87 109 } 88 110 else { … … 101 123 int startIndex, 102 124 int endIndex, 103 ITaskTreeBuilder builder,104 ITaskTreeNodeFactory nodeFactory,105 125 RuleApplicationResult result) 106 126 { 107 IIteration iteration = nodeFactory.createNewIteration(); 108 builder.setDescription(iteration, "value selection on " + trackbar.getStringIdentifier()); 127 IIteration iteration = taskTreeNodeFactory.createNewIteration(); 128 taskTreeBuilder.setDescription 129 (iteration, "value selection on " + trackbar.getStringIdentifier()); 109 130 result.addNewlyCreatedParentNode(iteration); 110 131 111 ISelection selection = nodeFactory.createNewSelection();132 ISelection selection = taskTreeNodeFactory.createNewSelection(); 112 133 result.addNewlyCreatedParentNode(selection); 113 builder.setChild(iteration, selection);134 taskTreeBuilder.setChild(iteration, selection); 114 135 115 136 for (int i = endIndex - startIndex; i >= 0; i--) { 116 addChildIfNecessary(selection, parent.getChildren().get(startIndex), builder, 117 nodeFactory, result); 118 builder.removeChild((ISequence) parent, startIndex); 137 addChildIfNecessary(selection, parent.getChildren().get(startIndex), result); 138 taskTreeBuilder.removeChild((ISequence) parent, startIndex); 119 139 } 120 140 121 builder.addChild((ISequence) parent, startIndex, iteration);141 taskTreeBuilder.addChild((ISequence) parent, startIndex, iteration); 122 142 123 143 result.setRuleApplicationStatus(RuleApplicationStatus.RULE_APPLICATION_FINISHED); … … 129 149 private void addChildIfNecessary(ISelection parentSelection, 130 150 ITaskTreeNode node, 131 ITaskTreeBuilder builder,132 ITaskTreeNodeFactory nodeFactory,133 151 RuleApplicationResult result) 134 152 { … … 144 162 145 163 // if we did not return in the previous checks, then the node must be added 146 builder.addChild(parentSelection, node);164 taskTreeBuilder.addChild(parentSelection, node); 147 165 } 148 166
Note: See TracChangeset
for help on using the changeset viewer.