Пример #1
0
        public static GraphicsElement Produce(BaseType value)
        {
            if (value == null)
                return new ScalarGraphics(new VapeTeam.Psimulex.Core.Types.String("NULL"));
            switch (value.Type.TypeEnum)
            {
                case TypeEnum.Integer:
             					return new ScalarGraphics(value);
                case TypeEnum.Array:
                    return new ArrayGraphics(value.ToArray());
                case TypeEnum.Tree:
                    return new TreeGraphics(value.ToTree());
                case TypeEnum.BinaryTree:
                    return new TreeGraphics(value.ToBinaryTree());

                default:
                    if (TypeHierarchy.IsContainer(value))
                    {
                        return new ArrayGraphics(value as AbstractCollection);
                    }
                    return new ScalarGraphics(value);
            }
        }
Пример #2
0
 protected BinaryTree CopyTree(BaseType value)
 {
     return value.ToBinaryTree().CopyReferenced();
 }
Пример #3
0
 public override void Assign(BaseType value)
 {
     BinaryTree otherBinTree = value.ToBinaryTree();
     this.Value = otherBinTree.Value;
     this.Left = otherBinTree.Left;
     this.Right = otherBinTree.Right;
 }
Пример #4
0
 public override void Add(BaseType value)
 {
     if (Left == null)
     {
         Left = value.ToBinaryTree();
     }
     else if (Right == null)
     {
         Right = value.ToBinaryTree();
     }
     else
     {
         throw new Exceptions.PsimulexCoreException("The binary tree already has two children. You cannot add a third one.");
     }
 }