Last change
on this file since 1045 was
922,
checked in by sherbold, 12 years ago
|
- renaming of packages from de.ugoe.cs.quest to de.ugoe.cs.autoquest
|
File size:
1.2 KB
|
Rev | Line | |
---|
[922] | 1 | package de.ugoe.cs.autoquest.tasktrees.nodeequality; |
---|
[807] | 2 | |
---|
[922] | 3 | import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; |
---|
| 4 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode; |
---|
[807] | 5 | |
---|
| 6 | /** |
---|
| 7 | * <p> |
---|
| 8 | * This rule identifies two task tree nodes as lexically equal, if they are both event tasks and |
---|
| 9 | * if their respective event types and targets equal. |
---|
| 10 | * </p> |
---|
| 11 | * |
---|
| 12 | * @author Patrick Harms |
---|
| 13 | */ |
---|
| 14 | public class EventTaskComparisonRule implements NodeComparisonRule { |
---|
| 15 | |
---|
| 16 | /* |
---|
| 17 | * (non-Javadoc) |
---|
| 18 | * |
---|
| 19 | * @see de.ugoe.cs.tasktree.nodeequality.NodeEqualityRule#apply(TaskTreeNode, TaskTreeNode) |
---|
| 20 | */ |
---|
| 21 | @Override |
---|
| 22 | public NodeEquality compare(ITaskTreeNode node1, ITaskTreeNode node2) { |
---|
| 23 | if ((!(node1 instanceof IEventTask)) || (!(node2 instanceof IEventTask))) { |
---|
| 24 | return null; |
---|
| 25 | } |
---|
| 26 | |
---|
| 27 | if (node1 == node2) { |
---|
| 28 | return NodeEquality.IDENTICAL; |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | IEventTask task1 = (IEventTask) node1; |
---|
| 32 | IEventTask task2 = (IEventTask) node2; |
---|
| 33 | |
---|
| 34 | if (task1.getEventType().equals(task2.getEventType()) && |
---|
| 35 | task1.getEventTarget().equals(task2.getEventTarget())) |
---|
| 36 | { |
---|
| 37 | return NodeEquality.LEXICALLY_EQUAL; |
---|
| 38 | } |
---|
| 39 | else { |
---|
| 40 | return NodeEquality.UNEQUAL; |
---|
| 41 | } |
---|
| 42 | } |
---|
| 43 | |
---|
| 44 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.