Changeset 10837 for branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionAfterManipulatorOperator.cs
- Timestamp:
- 05/11/14 18:29:47 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionAfterManipulatorOperator.cs
r10833 r10837 48 48 var a = nodesAfter[i]; 49 49 var b = nodesBefore[i]; 50 if (ReferenceEquals(a, b) && comparer.Equals(a, b)) continue; 50 51 bool found = false; 52 if (comparer.Equals(a, b)) { 53 int m = 0; 54 for (int j = 0; j < a.SubtreeCount; ++j) { 55 if (!AreSimilar(a.GetSubtree(j), b.GetSubtree(j), comparer)) { ++m; } 56 if (m > 1) { 57 found = true; 58 break; 59 } 60 } 61 if (m == 0) { 62 // everything is similar so we skip the whole subtree 63 i += a.GetLength(); 64 } 65 if (!found) continue; 66 } 51 67 fragment = new Fragment<ISymbolicExpressionTreeNode> { 52 68 Root = a, … … 60 76 return base.Apply(); 61 77 } 78 79 private bool AreSimilar(ISymbolicExpressionTreeNode a, ISymbolicExpressionTreeNode b, SymbolicExpressionTreeNodeSimilarityComparer comp) { 80 int length = a.GetLength(); 81 return comparer.Equals(a, b) && length.Equals(b.GetLength()) && SymbolicExpressionTreeMatching.Match(a, b, comp) == length; 82 } 62 83 } 63 84 }
Note: See TracChangeset
for help on using the changeset viewer.