source: trunk/quest-core-tasktrees/src/main/java/de/ugoe/cs/quest/tasktrees/nodeequality/NodeIdentityRule.java @ 557

Last change on this file since 557 was 557, checked in by pharms, 12 years ago
  • adapted task tree creation stuff to more general event handling
  • Property svn:executable set to *
File size: 1.2 KB
Line 
1// Module    : $RCSfile: NodeIdentityRule.java,v $
2// Version   : $Revision: 0.0 $  $Author: patrick $  $Date: 19.02.2012 $
3// Project   : TaskTreeCreator
4// Creation  : 2012 by patrick
5// Copyright : Patrick Harms, 2012
6
7package de.ugoe.cs.quest.tasktrees.nodeequality;
8
9import de.ugoe.cs.quest.tasktrees.treeifc.ITaskTreeNode;
10
11/**
12 * <p>
13 * This comparison rule returns <code>NodeEquality.IDENTICAL</code> if the comparison of the two
14 * task tree nodes using the <code>==</code> operator or the <code>equals</code> method return true.
15 * Else it returns null to denote, that it can not compare the nodes.
16 * </p>
17 *
18 * @version $Revision: $ $Date: 19.02.2012$
19 * @author 2012, last modified by $Author: patrick$
20 */
21public class NodeIdentityRule implements NodeComparisonRule {
22
23    /*
24     * (non-Javadoc)
25     *
26     * @see de.ugoe.cs.tasktree.nodeequality.NodeEqualityRule#apply(TaskTreeNode, TaskTreeNode)
27     */
28    @Override
29    public NodeEquality compare(ITaskTreeNode node1, ITaskTreeNode node2) {
30        if ((node1 == node2) || ((node1 != null) && (node1.equals(node2)))) {
31            return NodeEquality.IDENTICAL;
32        }
33        else {
34            return null;
35        }
36    }
37
38}
Note: See TracBrowser for help on using the repository browser.