예제 #1
0
파일: NeoFloat.cs 프로젝트: sci4me/Neo-old
 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}");
 }
예제 #2
0
파일: NeoFloat.cs 프로젝트: sci4me/Neo-old
 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);
     }
 }
예제 #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);
        }
예제 #4
0
 public override void Set(NeoValue key, NeoValue value) => this[key.CheckInt().Value] = value;
예제 #5
0
 public override NeoValue Get(NeoValue key) => this[key.CheckInt().Value];
예제 #6
0
 public override void Remove(NeoValue key) => data.RemoveAt(key.CheckInt().Value);