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.temporalrelation; |
---|
16 | |
---|
17 | import de.ugoe.cs.autoquest.tasktrees.nodeequality.NodeEquality; |
---|
18 | import de.ugoe.cs.autoquest.tasktrees.nodeequality.NodeEqualityRuleManager; |
---|
19 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode; |
---|
20 | import de.ugoe.cs.autoquest.usageprofiles.SymbolComparator; |
---|
21 | |
---|
22 | /** |
---|
23 | * <p> |
---|
24 | * TODO comment |
---|
25 | * </p> |
---|
26 | * |
---|
27 | * @author Patrick Harms |
---|
28 | */ |
---|
29 | public class TaskTreeNodeComparator implements SymbolComparator<ITaskTreeNode> { |
---|
30 | |
---|
31 | /** |
---|
32 | * <p> |
---|
33 | * the node equality manager needed for comparing task tree nodes with each other |
---|
34 | * </p> |
---|
35 | */ |
---|
36 | private NodeEqualityRuleManager nodeEqualityRuleManager; |
---|
37 | |
---|
38 | /** |
---|
39 | * <p> |
---|
40 | * the minimal node equality two identified sublists need to have to consider them as equal |
---|
41 | * and to create an iteration for |
---|
42 | * </p> |
---|
43 | */ |
---|
44 | private NodeEquality minimalNodeEquality; |
---|
45 | |
---|
46 | |
---|
47 | |
---|
48 | /** |
---|
49 | * <p> |
---|
50 | * TODO: comment |
---|
51 | * </p> |
---|
52 | * |
---|
53 | * @param nodeEqualityRuleManager |
---|
54 | * @param minimalNodeEquality |
---|
55 | */ |
---|
56 | public TaskTreeNodeComparator(NodeEqualityRuleManager nodeEqualityRuleManager, |
---|
57 | NodeEquality minimalNodeEquality) |
---|
58 | { |
---|
59 | super(); |
---|
60 | this.nodeEqualityRuleManager = nodeEqualityRuleManager; |
---|
61 | this.minimalNodeEquality = minimalNodeEquality; |
---|
62 | } |
---|
63 | |
---|
64 | |
---|
65 | |
---|
66 | /* (non-Javadoc) |
---|
67 | * @see de.ugoe.cs.autoquest.tasktrees.temporalrelation.SymbolComparator#equals(java.lang.Object, java.lang.Object) |
---|
68 | */ |
---|
69 | @Override |
---|
70 | public boolean equals(ITaskTreeNode symbol1, ITaskTreeNode symbol2) { |
---|
71 | return nodeEqualityRuleManager.applyRules(symbol1, symbol2).isAtLeast(minimalNodeEquality); |
---|
72 | } |
---|
73 | |
---|
74 | } |
---|