コード例 #1
0
 public Mould()
 {
     Root = new MouldItem <T>()
     {
         Level = -1, Parent = -1, Value = default(T)
     };
     Items = new List <MouldItem <T> >();
     Items.Add(Root);
     Relationships = new List <List <IRelationship> >();
 }
コード例 #2
0
ファイル: MouldItem.cs プロジェクト: frostbomber/Mould
 public void AddChild(MouldItem <T> newChild, T newChildValue)
 {
     newChild.Parent = Index;
     newChild.Level  = Level + 1;
     newChild.Index  = Index + 1;
     newChild.Value  = newChildValue;
     if (children == 0)
     {
         Mould.Items.Add(newChild);
     }
     else
     {
         Mould.Items.Insert(Index + children, newChild);
     }
     children++;
     if (children > 1)
     {
         newChild.NextSibling = Mould.Items[Index + children];
     }
 }
コード例 #3
0
        public Mould <T> MouldFrom(MouldItem <T> element)
        {
            int index = Items.IndexOf(element);

            return(SubMould(index));
        }