Beispiel #1
0
    public void AddTrunk()
    {
        var newSegment = new TrunkNode()
        {
            Position   = TrunkNodes.Count,
            BranchLeft = new BranchNode()
            {
                HasBranch = false
            },
            BranchRight = new BranchNode()
            {
                HasBranch = false
            }
        };

        newSegment.BranchLeft.AttachedTrunk  = newSegment;
        newSegment.BranchRight.AttachedTrunk = newSegment;

        TrunkNodes.Add(newSegment);
        BranchNodes.Add(newSegment.BranchLeft);
        BranchNodes.Add(newSegment.BranchRight);
        TrunkCost = this.CalculateTrunkCost();

        OnTrunkNodesUpdated?.Invoke();
    }
Beispiel #2
0
 internal void RemoveAllTwoWay()
 {
     foreach (var node in BranchNodes.ToArray())
     {
         RemoveTwoWay(node);
     }
 }
Beispiel #3
0
 public void RemoveTwoWay(InstructionNode node)
 {
     node.BranchProperties.Branches.Remove(this);
     BranchNodes.Remove(node);
 }
Beispiel #4
0
 public void AddTwoWay(InstructionNode node)
 {
     node.BranchProperties.Branches.AddDistinct(this);
     BranchNodes.Add(node);
 }