public Array(IShellData value) { contents = new List <IShellData> { value }; }
public IShellReturnable IndexOf(IShellData value) { if (contents.Contains(value)) { return(value); } else { return(new Shell.Types.None()); } }
public IShellReturnable IndexOf(IShellData value) { foreach (var pair in dict) { if (pair.Value == value) { return(pair.Key); } } return(new Shell.Types.None()); }
public override IShellReturnable Execute(State state, List <Tuple <int, string, IShellData> > args) { IShellData data = args.First().Item3; if (data is Property prop) { data = prop.Value; } if (data is Types.String str) { Console.WriteLine(str.contents); return(new Types.None()); } Console.WriteLine(data.ToString()); return(new Types.None()); }
public void Delete(IShellData index) => contents.RemoveAt(((Number)index).integerValue);
/// <summary> /// Allows insertion at an index. /// </summary> /// <remark> /// Insertion at Count => appending to the array /// </remark> public void Insert(IShellData index, IShellData value) { contents.Insert(((Shell.Types.Number)index).integerValue, value); }
public void Replace(IShellData index, IShellData value) { contents[((Number)index).integerValue] = value; }
public IShellData GetMember(IShellData index) => contents[((Number)index).integerValue];
public bool Exists(IShellData index) { return(index is Number n && n.isInt && n.integerValue < contents.Count); }
public void Delete(IShellData index) => dict.Remove((Shell.Types.String)index);
public void Insert(IShellData index, IShellData value) => dict[(Shell.Types.String)index] = value;
public void Replace(IShellData index, IShellData value) => dict[(Shell.Types.String)index] = value;
public IShellData GetMember(IShellData index) => dict[(Shell.Types.String)index];
public bool Exists(IShellData index) { return(index is String s && dict.ContainsKey(s)); }