예제 #1
0
 public Array(IShellData value)
 {
     contents = new List <IShellData>
     {
         value
     };
 }
예제 #2
0
 public IShellReturnable IndexOf(IShellData value)
 {
     if (contents.Contains(value))
     {
         return(value);
     }
     else
     {
         return(new Shell.Types.None());
     }
 }
예제 #3
0
        public IShellReturnable IndexOf(IShellData value)
        {
            foreach (var pair in dict)
            {
                if (pair.Value == value)
                {
                    return(pair.Key);
                }
            }

            return(new Shell.Types.None());
        }
예제 #4
0
        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());
        }
예제 #5
0
 public void Delete(IShellData index) => contents.RemoveAt(((Number)index).integerValue);
예제 #6
0
 /// <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);
 }
예제 #7
0
 public void Replace(IShellData index, IShellData value)
 {
     contents[((Number)index).integerValue] = value;
 }
예제 #8
0
 public IShellData GetMember(IShellData index) => contents[((Number)index).integerValue];
예제 #9
0
 public bool Exists(IShellData index)
 {
     return(index is Number n && n.isInt && n.integerValue < contents.Count);
 }
예제 #10
0
 public void Delete(IShellData index) => dict.Remove((Shell.Types.String)index);
예제 #11
0
 public void Insert(IShellData index, IShellData value) => dict[(Shell.Types.String)index] = value;
예제 #12
0
 public void Replace(IShellData index, IShellData value) => dict[(Shell.Types.String)index] = value;
예제 #13
0
 public IShellData GetMember(IShellData index) => dict[(Shell.Types.String)index];
예제 #14
0
 public bool Exists(IShellData index)
 {
     return(index is String s && dict.ContainsKey(s));
 }