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}"); }
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); } }
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); }
public override void Set(NeoValue key, NeoValue value) => this[key.CheckInt().Value] = value;
public override NeoValue Get(NeoValue key) => this[key.CheckInt().Value];
public override void Remove(NeoValue key) => data.RemoveAt(key.CheckInt().Value);