Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9057


Ignore:
Timestamp:
12/14/12 13:03:29 (12 years ago)
Author:
bburlacu
Message:

#1763: Fixed bug in subtree cut/paste introduced with previous commit, simplified code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicExpressionTreeChart.cs

    r9056 r9057  
    217217        case EditOp.CutSubtree: {
    218218            if (tempNode.IterateNodesBreadth().Contains(node))
    219               throw new ArgumentException();
     219              throw new ArgumentException();// cannot cut/paste a node into itself
     220            ModifyTree(Tree, tempNode.Parent, tempNode, null); //remove node from its original parent     
     221            ModifyTree(Tree, node, null, tempNode); //insert it as a child to the new parent
    220222            break;
    221223          }
    222224        case EditOp.CopySubtree: {
    223225            var clone = (SymbolicExpressionTreeNode)tempNode.Clone();
    224             clone.Parent = tempNode.Parent;
    225             tempNode = clone;
    226             ModifyTree(Tree, node, null, tempNode);
     226            ModifyTree(Tree, node, null, clone);
    227227            break;
    228228          }
Note: See TracChangeset for help on using the changeset viewer.