Exemple #1
0
        public override object Clone()
        {
            SirenCustomClass val = new SirenCustomClass(Name)
            {
                Attribute = Attribute.Clone() as SirenClassAttribute
            };

            val.BaseTypeName = BaseTypeName;
            val.BaseType     = BaseType.Clone() as SirenCustomClass;
            foreach (var baseSirenCustomType in Types)
            {
                val.Types.Add(baseSirenCustomType.Key, baseSirenCustomType.Value.Clone() as BaseSirenCustomType);
            }

            foreach (var sirenField in FieldNameDict)
            {
                val.FieldNameDict.Add(sirenField.Key, sirenField.Value.Clone() as SirenField);
            }


            return(val);
        }
Exemple #2
0
        public void Insert(long key, BaseType value)
        {
            int index = rep.FindIndex(item => item.Priority < key);

            if (index == -1)
                index = rep.Count;

            rep.Insert(index, new Pair { Priority = key, Value = value.Clone() });

            OnChanged();
            //if (Count == 0)
            //{
            //    rep.Add(new Pair { Priority = key, Value = value });
            //}
            //else
            //{
            //    for (int i = 0; i < Count; i++)
            //    {
            //        if (rep[i].Priority < key)
            //        {
            //            rep.Insert(i, new Pair { Priority = key, Value = value });
            //            return;
            //        }
            //    }
            //}
        }
Exemple #3
0
 /// <summary>
 /// Converting from scalar.
 /// </summary>
 /// <param name="value"></param>
 public Array(BaseType value)
     : this(value.Type, 1)
 {
     rep[0] = value.Clone();
 }
Exemple #4
0
 public override void Add(BaseType value)
 {
     if (value.Type.TypeEnum == this.Type.TypeEnum)
     {
         AddRange(value);
     }
     else
     {
         rep.Add(value.Clone());
     }
     OnChanged();
 }
Exemple #5
0
 public AbstractList(BaseType value)
 {
     rep.Add(value.Clone());
 }
Exemple #6
0
 public virtual void AddRange(BaseType value)
 {
     rep.AddRange(value.Clone().ToList().AsEnumerable());
     OnChanged();
 }