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

Last change on this file since 439 was 439, checked in by pharms, 12 years ago

initial import after refactoring of module structure with Steffen

  • Property svn:executable set to *
File size: 2.5 KB
Line 
1//-------------------------------------------------------------------------------------------------
2// Module    : $RCSfile: NodeEqualityRuleManager.java,v $
3// Version   : $Revision: 0.0 $  $Author: patrick $  $Date: 19.02.2012 $
4// Project   : TaskTreeCreator
5// Creation  : 2012 by patrick
6// Copyright : Patrick Harms, 2012
7//-------------------------------------------------------------------------------------------------
8package de.ugoe.cs.quest.tasktrees.nodeequality;
9
10import java.util.ArrayList;
11import java.util.List;
12//import java.util.logging.Logger;
13
14import de.ugoe.cs.quest.tasktrees.treeifc.TaskTreeNode;
15
16//-------------------------------------------------------------------------------------------------
17/**
18 * TODO comment
19 *
20 * @version $Revision: $ $Date: 19.02.2012$
21 * @author 2012, last modified by $Author: patrick$
22 */
23//-------------------------------------------------------------------------------------------------
24public class NodeEqualityRuleManager
25{
26
27  /** */
28  //private static Logger LOG = Logger.getLogger(NodeEqualityRuleManager.class.getName());
29
30  /** */
31  private List<NodeComparisonRule> mRuleIndex = new ArrayList<NodeComparisonRule>();
32
33  //-----------------------------------------------------------------------------------------------
34  /**
35   * TODO: comment
36   *
37   */
38  //-----------------------------------------------------------------------------------------------
39  public void init()
40  {
41    mRuleIndex.add(new NodeIdentityRule());
42    mRuleIndex.add(new IterationComparisonRule(this));
43    mRuleIndex.add(new SequenceComparisonRule(this));
44    mRuleIndex.add(new SelectionComparisonRule(this));
45  }
46
47  //-----------------------------------------------------------------------------------------------
48  /**
49   * TODO: comment
50   *
51   * @param node1
52   * @param node2
53   * @return
54   */
55  //-----------------------------------------------------------------------------------------------
56  public NodeEquality applyRules(TaskTreeNode node1, TaskTreeNode node2)
57  {
58    //LOG.info("checking for equality of " + node1 + " and " + node2);
59    NodeEquality nodeEquality = null;
60     
61    for (NodeComparisonRule rule : mRuleIndex)
62    {
63      nodeEquality = rule.compare(node1, node2);
64     
65      if (nodeEquality != null)
66      {
67        //LOG.warning("used rule " + rule + " for equality check");
68        return nodeEquality;
69      }
70    }
71   
72    //LOG.warning("no rule could be applied --> handling nodes as unequal");
73   
74    return new NodesUnequal();
75  }
76
77}
Note: See TracBrowser for help on using the repository browser.