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

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