Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/18/08 16:20:26 (16 years ago)
Author:
gkronber
Message:

added Size and Height properties to interface IFunctionTree and removed the helper methods from TreeGardener (specific implementations of size and height properties in classes implementing IFunctionTree can be more efficient than the general functions in TreeGardener)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.StructureIdentification/Manipulation/ChangeNodeTypeManipulation.cs

    r238 r324  
    9696        // calculate the height and size difference and
    9797        // check if the size of the new tree is still in the allowed bounds
    98         int oldChildSize = gardener.GetTreeSize(selectedChild);
    99         int oldChildHeight = gardener.GetTreeSize(selectedChild);
    100         int newChildSize = gardener.GetTreeSize(newFunctionTree);
    101         int newChildHeight = gardener.GetTreeHeight(newFunctionTree);
     98        int oldChildSize = selectedChild.Size;
     99        int oldChildHeight = selectedChild.Height;
     100        int newChildSize = newFunctionTree.Size;
     101        int newChildHeight = newFunctionTree.Height;
    102102        if((treeHeight.Data - oldChildHeight) + newChildHeight > maxTreeHeight ||
    103103          (treeSize.Data - oldChildSize) + newChildSize > maxTreeSize) {
     
    118118        // update size and height
    119119        treeSize.Data = (treeSize.Data - oldChildSize) + newChildSize;
    120         treeHeight.Data = gardener.GetTreeHeight(root); // must recalculate height because we can't know wether the manipulated branch was the deepest branch
     120        treeHeight.Data = root.Height; // must recalculate height because we can't know wether the manipulated branch was the deepest branch
    121121        // check if whole tree is ok
    122122        Debug.Assert(gardener.IsValidTree(root));
Note: See TracChangeset for help on using the changeset viewer.