1 | // Copyright 2012 Georg-August-Universität Göttingen, Germany |
---|
2 | // |
---|
3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
---|
4 | // you may not use this file except in compliance with the License. |
---|
5 | // You may obtain a copy of the License at |
---|
6 | // |
---|
7 | // http://www.apache.org/licenses/LICENSE-2.0 |
---|
8 | // |
---|
9 | // Unless required by applicable law or agreed to in writing, software |
---|
10 | // distributed under the License is distributed on an "AS IS" BASIS, |
---|
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
12 | // See the License for the specific language governing permissions and |
---|
13 | // limitations under the License. |
---|
14 | |
---|
15 | package de.ugoe.cs.autoquest.tasktrees.nodeequality; |
---|
16 | |
---|
17 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode; |
---|
18 | |
---|
19 | /** |
---|
20 | * <p> |
---|
21 | * This comparison rule returns <code>NodeEquality.IDENTICAL</code> if the comparison of the two |
---|
22 | * task tree nodes using the <code>==</code> operator or the <code>equals</code> method return true. |
---|
23 | * Else it returns null to denote, that it can not compare the nodes. |
---|
24 | * </p> |
---|
25 | * |
---|
26 | * @version $Revision: $ $Date: 19.02.2012$ |
---|
27 | * @author 2012, last modified by $Author: patrick$ |
---|
28 | */ |
---|
29 | public class NodeIdentityRule implements NodeComparisonRule { |
---|
30 | |
---|
31 | /* |
---|
32 | * (non-Javadoc) |
---|
33 | * |
---|
34 | * @see de.ugoe.cs.tasktree.nodeequality.NodeEqualityRule#apply(TaskTreeNode, TaskTreeNode) |
---|
35 | */ |
---|
36 | @Override |
---|
37 | public NodeEquality compare(ITaskTreeNode node1, ITaskTreeNode node2) { |
---|
38 | if (node1 == node2) { |
---|
39 | return NodeEquality.IDENTICAL; |
---|
40 | } |
---|
41 | else { |
---|
42 | return null; |
---|
43 | } |
---|
44 | } |
---|
45 | |
---|
46 | } |
---|