Changeset 12933 for branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching
- Timestamp:
- 09/02/15 16:26:23 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/QueryMatch.cs
r12929 r12933 47 47 } 48 48 49 // whether matching nodes should also have matching parents 50 // in theory, this restricts the matching so that parent-child 51 // pairs in the query tree are matched by parent-child pairs in 52 // the data tree (and not ancestor-descendant pairs) 53 public bool MatchParents { get; set; } 54 49 55 public QueryMatch(ISymbolicExpressionTreeNodeEqualityComparer comparer) { 50 56 this.comparer = comparer; … … 70 76 } 71 77 78 private bool AreMatching(NodeInfo a, NodeInfo b) { 79 bool equals = comparer.Equals(a.Node, b.Node); 80 81 if (equals && MatchParents) { 82 var pa = a.Parent(); 83 var pb = b.Parent(); 84 if (pa != null && pb != null) 85 return comparer.Equals(pa.Node, pb.Node); 86 if (!(pa == null && pb == null)) 87 return false; 88 } 89 return equals; 90 } 91 72 92 private NodeInfo Tmatch(NodeInfo d, NodeInfo qFrom, NodeInfo qUntil, int tab = 0) { 73 93 #if DEBUG … … 77 97 78 98 var next = qBest.Next(); 79 if (next.Index <= qUntil.Index && comparer.Equals(d.Node, next.Node)) {99 if (next.Index <= qUntil.Index && AreMatching(d, next)) { 80 100 qBest = next; 81 101 next = qBest.Next();
Note: See TracChangeset
for help on using the changeset viewer.