Exemple #1
0
 public override int Compare(NeoValue other)
 {
     if (other.IsInt)
     {
         return(((double)other.CheckInt().Value).CompareTo(Value));
     }
     else if (other.IsFloat)
     {
         return(other.CheckFloat().Value.CompareTo(Value));
     }
     throw new NeoError($"Attempt to compare float to {other.Type}");
 }
Exemple #2
0
 public override bool Equals(NeoValue other, bool deep)
 {
     if (other.IsInt)
     {
         return(((double)other.CheckInt().Value) == Value);
     }
     else if (other.IsFloat)
     {
         return(other.CheckFloat().Value == Value);
     }
     else
     {
         return(false);
     }
 }
Exemple #3
0
        public override NeoValue Slice(NeoValue start, NeoValue end)
        {
            var s = start.CheckInt().Value;
            var e = end.CheckInt().Value;
            var d = s > e ? -1 : 1;

            var a = new NeoArray();
            var i = s;

            while (i != e)
            {
                a.Insert(this[i]);
                i += d;
            }
            a.Insert(this[i]);

            return(a);
        }
Exemple #4
0
 public override void Set(NeoValue key, NeoValue value) => this[key.CheckInt().Value] = value;
Exemple #5
0
 public override NeoValue Get(NeoValue key) => this[key.CheckInt().Value];
Exemple #6
0
 public override void Remove(NeoValue key) => data.RemoveAt(key.CheckInt().Value);