GetValue() публичный Метод

public GetValue ( int Index ) : Value
Index int
Результат Value
Пример #1
0
        public Value Insert(List Arguments)
        {
            Value first = Arguments.GetValue(0);
            int   index;

            if (first is Number)
            {
                index = (int)((first as Number).Val);
            }
            else
            {
                throw new Exception("First parameter must be a number");
            }

            var second = Arguments.GetValue(1);

            if (index >= 0 && index < Arr.Count)
            {
                Arr.Insert(index, new Reference(second));
            }
            else
            {
                throw new Exception("Index is out of bounds");
            }
            return(this);
        }
Пример #2
0
 public Value Ceiling(List Arguments)
 {
     if (Arguments.GetValue(0) is Number)
     {
         return(new Number(Math.Ceiling(((Number)Arguments.GetValue(0)).Val)));
     }
     throw new Exception("Ceiling function takes only a number");
 }
Пример #3
0
 public Value Floor(List Arguments)
 {
     if (Arguments.GetValue(0) is Number)
     {
         return(new Number(Math.Floor(((Number)Arguments.GetValue(0)).Val)));
     }
     throw new Exception("Floor function takes only a number");
 }
Пример #4
0
 public Value RemoveAt(List Arguments)
 {
     for (int i = 0; i < Arguments.Arr.Count; i++)
     {
         Value value = Arguments.GetValue(i);
         if (value is Number)
         {
             var index = (int)(value as Number).Val;
             Arr.RemoveAt(index);
         }
     }
     return(this);
 }
Пример #5
0
 public Value Tan( List Arguments )
 {
     if ( Arguments.GetValue( 0 ) is Number )
         return new Number( Math.Tan( ( (Number)Arguments.GetValue( 0 ) ).Val ) );
     throw new Exception( "Tan function takes only a number" );
 }