- Timestamp:
- 09/07/15 10:29:13 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeMatching/QueryMatch.cs
r12941 r12942 76 76 } 77 77 78 private NodeInfo Tmatch(NodeInfo d, NodeInfo qFrom, NodeInfo qUntil , int tab = 0) {79 NodeInfo qBest = d.IsLeaf ? qFrom.Previous : Hmatch(d.LastChild, qFrom, qUntil , tab + 1);78 private NodeInfo Tmatch(NodeInfo d, NodeInfo qFrom, NodeInfo qUntil) { 79 NodeInfo qBest = d.IsLeaf ? qFrom.Previous : Hmatch(d.LastChild, qFrom, qUntil); 80 80 var next = qBest.Next; 81 81 if (next.Index <= qUntil.Index && AreMatching(d, next)) { … … 83 83 next = qBest.Next; 84 84 var lastSibling = qBest.LastSibling; 85 return next.Index <= lastSibling.Index ? Tmatch(d, next, lastSibling , tab + 1) : qBest;85 return next.Index <= lastSibling.Index ? Tmatch(d, next, lastSibling) : qBest; 86 86 } 87 87 return qBest; 88 88 } 89 89 90 private NodeInfo Hmatch(NodeInfo d, NodeInfo qFrom, NodeInfo qUntil , int tab = 0) {90 private NodeInfo Hmatch(NodeInfo d, NodeInfo qFrom, NodeInfo qUntil) { 91 91 if (d.IsFirstSibling) 92 return Tmatch(d, qFrom, qUntil , tab + 1);93 94 var qHedge = Hmatch(d.PreviousSibling, qFrom, qUntil , tab + 1);95 var qTree = Tmatch(d, qFrom, qUntil , tab + 1);92 return Tmatch(d, qFrom, qUntil); 93 94 var qHedge = Hmatch(d.PreviousSibling, qFrom, qUntil); 95 var qTree = Tmatch(d, qFrom, qUntil); 96 96 97 97 for (;;) { … … 99 99 return qHedge; 100 100 if (qTree.Index < qHedge.Index) { 101 var rtop = Rtop(qTree.Next, qHedge , tab);101 var rtop = Rtop(qTree.Next, qHedge); 102 102 while (rtop.Index < qHedge.Next.Index && qHedge.Index < rtop.LastSibling.Index) { 103 qTree = Tmatch(d, rtop.Next, rtop.LastSibling , tab + 1);104 rtop = Rtop(qTree.Next, qHedge , tab);103 qTree = Tmatch(d, rtop.Next, rtop.LastSibling); 104 rtop = Rtop(qTree.Next, qHedge); 105 105 } 106 106 if (qTree.Index <= qHedge.Index) 107 107 return qHedge; 108 108 } else { 109 var rtop = Rtop(qHedge.Next, qTree , tab);109 var rtop = Rtop(qHedge.Next, qTree); 110 110 while (rtop.Index < qTree.Next.Index && qTree.Index < rtop.LastSibling.Index) { 111 qHedge = Hmatch(d.PreviousSibling, rtop.Next, rtop.LastSibling , tab + 1);112 rtop = Rtop(qHedge.Next, qTree , tab);111 qHedge = Hmatch(d.PreviousSibling, rtop.Next, rtop.LastSibling); 112 rtop = Rtop(qHedge.Next, qTree); 113 113 } 114 114 if (qHedge.Index <= qTree.Index) … … 119 119 120 120 // returns the rightmost node from the topmost nodes in the interval [hFrom, hUntil] 121 private NodeInfo Rtop(NodeInfo hFrom, NodeInfo hUntil , int tab = 0) {121 private NodeInfo Rtop(NodeInfo hFrom, NodeInfo hUntil) { 122 122 if (hFrom == hUntil) 123 123 return hUntil;
Note: See TracChangeset
for help on using the changeset viewer.