Changeset 1107 for trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TemporalRelationshipRuleManager.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/TemporalRelationshipRuleManager.java
r987 r1107 79 79 /** 80 80 * <p> 81 * the temporal relationship rule known to the manager. The rules are applied in the order 82 * they occur in this list. 83 * </p> 84 */ 85 private List<TemporalRelationshipRule> rules = new ArrayList<TemporalRelationshipRule>(); 86 87 /** 88 * <p> 89 * initialize the manager with a node equality rule manager to be used by the known rules 90 * for task tree node comparison. 91 * </p> 92 */ 93 public TemporalRelationshipRuleManager(NodeEqualityRuleManager nodeEqualityRuleManager) { 81 * the task tree node factory to be used during rule application 82 * </p> 83 */ 84 private ITaskTreeNodeFactory taskTreeNodeFactory; 85 86 /** 87 * <p> 88 * the task tree builder to be used during rule application 89 * </p> 90 */ 91 private ITaskTreeBuilder taskTreeBuilder; 92 93 /** 94 * <p> 95 * the temporal relationship rules known to the manager that are executed on whole sub trees. 96 * The rules are applied in the order they occur in this list. 97 * </p> 98 */ 99 private TemporalRelationshipRule[] treeScopeRules; 100 101 /** 102 * <p> 103 * the temporal relationship rules known to the manager that are executed on whole sub trees. 104 * The rules are applied in the order they occur in this list. 105 * </p> 106 */ 107 private TemporalRelationshipRule[] nodeScopeRules; 108 109 /** 110 * <p> 111 * initialize the manager 112 * </p> 113 * 114 * @param nodeEqualityRuleManager the node equality rule manager to be used by the known rules 115 * for task tree node comparison during rule application 116 * @param taskTreeNodeFactory the node factory to be used for instantiating new task tree 117 * nodes during rule application 118 * @param taskTreeBuilder the task tree builder to be used for linking task tree nodes 119 * with each other during rule application 120 */ 121 public TemporalRelationshipRuleManager(NodeEqualityRuleManager nodeEqualityRuleManager, 122 ITaskTreeNodeFactory taskTreeNodeFactory, 123 ITaskTreeBuilder taskTreeBuilder) 124 { 94 125 super(); 95 126 this.nodeEqualityRuleManager = nodeEqualityRuleManager; 127 this.taskTreeNodeFactory = taskTreeNodeFactory; 128 this.taskTreeBuilder = taskTreeBuilder; 96 129 } 97 130 … … 107 140 frameFilter.add(IFrame.class); 108 141 frameFilter.add(IDialog.class); 109 110 rules.add(new DefaultGuiElementSequenceDetectionRule(frameFilter)); 111 rules.add(new DefaultGuiElementSequenceDetectionRule()); 112 rules.add(new DefaultEventTargetSequenceDetectionRule()); 113 rules.add(new TrackBarSelectionDetectionRule(nodeEqualityRuleManager)); 114 //rules.add(new DefaultGuiEventSequenceDetectionRule()); 142 //frameFilter.add(ICanvas.class); 143 144 treeScopeRules = new TemporalRelationshipRule[] { 145 new DefaultTaskSequenceDetectionRule 146 (nodeEqualityRuleManager, NodeEquality.SEMANTICALLY_EQUAL, 147 taskTreeNodeFactory, taskTreeBuilder) 148 }; 115 149 116 rules.add(new DefaultIterationDetectionRule 117 (nodeEqualityRuleManager, NodeEquality.LEXICALLY_EQUAL)); 118 rules.add(new DefaultIterationDetectionRule 119 (nodeEqualityRuleManager, NodeEquality.SYNTACTICALLY_EQUAL)); 120 rules.add(new DefaultIterationDetectionRule 121 (nodeEqualityRuleManager, NodeEquality.SEMANTICALLY_EQUAL)); 150 //treeScopeRules.add(new DefaultGuiElementSequenceDetectionRule(frameFilter)); 151 152 nodeScopeRules = new TemporalRelationshipRule[] { 153 //new DefaultGuiElementSequenceDetectionRule(taskTreeNodeFactory, taskTreeBuilder), 154 //new DefaultEventTargetSequenceDetectionRule(taskTreeNodeFactory, taskTreeBuilder), 155 new TrackBarSelectionDetectionRule 156 (nodeEqualityRuleManager, taskTreeNodeFactory, taskTreeBuilder), 157 //new DefaultGuiEventSequenceDetectionRule(taskTreeNodeFactory, taskTreeBuilder), 158 new DefaultIterationDetectionRule 159 (nodeEqualityRuleManager, NodeEquality.LEXICALLY_EQUAL, 160 taskTreeNodeFactory, taskTreeBuilder), 161 new DefaultIterationDetectionRule 162 (nodeEqualityRuleManager, NodeEquality.SYNTACTICALLY_EQUAL, 163 taskTreeNodeFactory, taskTreeBuilder), 164 new DefaultIterationDetectionRule 165 (nodeEqualityRuleManager, NodeEquality.SEMANTICALLY_EQUAL, 166 taskTreeNodeFactory, taskTreeBuilder) 167 }; 168 169 } 170 171 /** 172 * <p> 173 * applies the known rules to the provided parent node. For the creation of further nodes, 174 * the provided builder and node factory are utilized. The method expectes, that no more data 175 * is available and, therefore, finalizes the rule application. 176 * </p> 177 * 178 * @param nodeFactory the node factory to be used for instantiating new task tree nodes. 179 */ 180 public void applyRules(ITaskTreeNode parent) { 181 applyRules(parent, true); 122 182 } 123 183 … … 132 192 * 133 193 * @param parent the parent node to apply the rules on 134 * @param builder the task tree builder to be used for linking task tree nodes with each135 * other136 * @param nodeFactory the node factory to be used for instantiating new task tree nodes.137 194 * @param finalize used to indicate, if the rule application shall break up if a rule would 138 195 * be feasible if further data was available, or not. 139 196 */ 140 public void applyRules(ITaskTreeNode parent, 141 ITaskTreeBuilder builder, 142 ITaskTreeNodeFactory nodeFactory, 143 boolean finalize) 144 { 145 applyRules(parent, builder, nodeFactory, finalize, ""); 197 public void applyRules(ITaskTreeNode parent, boolean finalize) { 198 applyRules(treeScopeRules, parent, finalize, ""); 146 199 } 147 200 … … 157 210 * 158 211 * @param parent the parent node to apply the rules on 159 * @param builder the task tree builder to be used for linking task tree nodes with each160 * other161 * @param nodeFactory the node factory to be used for instantiating new task tree nodes.162 212 * @param finalize used to indicate, if the rule application shall break up if a rule would 163 213 * be feasible if further data was available, or not. … … 165 215 * on the recursion depth of calling this method. 166 216 */ 167 private int applyRules(ITaskTreeNode parent, 168 ITaskTreeBuilder builder, 169 ITaskTreeNodeFactory nodeFactory, 170 boolean finalize, 171 String logIndent) 217 private int applyRules(TemporalRelationshipRule[] rules, 218 ITaskTreeNode parent, 219 boolean finalize, 220 String logIndent) 172 221 { 173 222 Console.traceln(Level.FINER, logIndent + "applying rules for " + parent); … … 179 228 do { 180 229 Console.traceln(Level.FINER, logIndent + "trying rule " + rule + " on " + parent); 181 result = rule.apply(parent, builder, nodeFactory,finalize);230 result = rule.apply(parent, finalize); 182 231 183 232 if ((result != null) && … … 193 242 for (ITaskTreeNode newParent : result.getNewlyCreatedParentNodes()) { 194 243 noOfRuleApplications += 195 applyRules(n ewParent, builder, nodeFactory, true, logIndent + " ");244 applyRules(nodeScopeRules, newParent, true, logIndent + " "); 196 245 } 197 246 }
Note: See TracChangeset
for help on using the changeset viewer.