Changeset 1146 for trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/EventTaskComparisonRule.java
- Timestamp:
- 04/04/13 16:06:07 (11 years ago)
- Location:
- trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality
- Files:
-
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/EventTaskComparisonRule.java
r1125 r1146 13 13 // limitations under the License. 14 14 15 package de.ugoe.cs.autoquest.tasktrees. nodeequality;15 package de.ugoe.cs.autoquest.tasktrees.taskequality; 16 16 17 17 import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 18 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask TreeNode;18 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 19 19 20 20 /** 21 21 * <p> 22 * This rule identifies two task tree nodes as lexically equal, if they are both event tasks and22 * This rule identifies two tasks as lexically equal, if they are both event tasks and 23 23 * if their respective event types and targets equal. 24 24 * </p> … … 26 26 * @author Patrick Harms 27 27 */ 28 public class EventTaskComparisonRule implements NodeComparisonRule {28 public class EventTaskComparisonRule implements TaskComparisonRule { 29 29 30 30 /* (non-Javadoc) 31 * @see NodeComparisonRule#isApplicable(ITask TreeNode, ITaskTreeNode)31 * @see NodeComparisonRule#isApplicable(ITask, ITask) 32 32 */ 33 33 @Override 34 public boolean isApplicable(ITask TreeNode node1, ITaskTreeNode node2) {35 return ( node1 instanceof IEventTask) && (node2 instanceof IEventTask);34 public boolean isApplicable(ITask task1, ITask task2) { 35 return (task1 instanceof IEventTask) && (task2 instanceof IEventTask); 36 36 } 37 37 38 38 /* (non-Javadoc) 39 * @see NodeComparisonRule#areLexicallyEqual(ITask TreeNode, ITaskTreeNode)39 * @see NodeComparisonRule#areLexicallyEqual(ITask, ITask) 40 40 */ 41 41 @Override 42 public boolean areLexicallyEqual(ITask TreeNode node1, ITaskTreeNode node2) {43 IEventTask task1 = (IEventTask) node1;44 IEventTask task2 = (IEventTask) node2;42 public boolean areLexicallyEqual(ITask task1, ITask task2) { 43 IEventTask eventTask1 = (IEventTask) task1; 44 IEventTask eventTask2 = (IEventTask) task2; 45 45 46 return ( task1.getEventType().equals(task2.getEventType()) &&47 task1.getEventTarget().equals(task2.getEventTarget()));46 return (eventTask1.getEventType().equals(eventTask2.getEventType()) && 47 eventTask1.getEventTarget().equals(eventTask2.getEventTarget())); 48 48 } 49 49 50 50 /* (non-Javadoc) 51 * @see NodeComparisonRule#areSyntacticallyEqual(ITask TreeNode, ITaskTreeNode)51 * @see NodeComparisonRule#areSyntacticallyEqual(ITask, ITask) 52 52 */ 53 53 @Override 54 public boolean areSyntacticallyEqual(ITask TreeNode node1, ITaskTreeNode node2) {55 return areLexicallyEqual( node1, node2);54 public boolean areSyntacticallyEqual(ITask task1, ITask task2) { 55 return areLexicallyEqual(task1, task2); 56 56 } 57 57 58 58 /* (non-Javadoc) 59 * @see NodeComparisonRule#areSemanticallyEqual(ITask TreeNode, ITaskTreeNode)59 * @see NodeComparisonRule#areSemanticallyEqual(ITask, ITask) 60 60 */ 61 61 @Override 62 public boolean areSemanticallyEqual(ITask TreeNode node1, ITaskTreeNode node2) {63 return areLexicallyEqual( node1, node2);62 public boolean areSemanticallyEqual(ITask task1, ITask task2) { 63 return areLexicallyEqual(task1, task2); 64 64 } 65 65 66 66 @Override 67 public NodeEquality compare(ITaskTreeNode node1, ITaskTreeNode node2) {68 if (areLexicallyEqual( node1, node2)) {69 return NodeEquality.LEXICALLY_EQUAL;67 public TaskEquality compare(ITask task1, ITask task2) { 68 if (areLexicallyEqual(task1, task2)) { 69 return TaskEquality.LEXICALLY_EQUAL; 70 70 } 71 71 else { 72 return NodeEquality.UNEQUAL;72 return TaskEquality.UNEQUAL; 73 73 } 74 74 }
Note: See TracChangeset
for help on using the changeset viewer.