Example #1
0
        public override Value View(CellAddr ulCa, CellAddr lrCa)
        {
            int cols = Cols, rows = Rows, col0 = ulCa.col, row0 = ulCa.row;

            Value[,] vals = new Value[cols, rows];
            for (int c = 0; c < cols; c++)
            {
                for (int r = 0; r < rows; r++)
                {
                    vals[c, r] = NumberValue.Make(matrix[row0 + r, col0 + c]);
                }
            }
            return(new ArrayExplicit(vals));
        }
Example #2
0
 public static Value FromDoubleArray1D(Object o)
 {
     double[] xs = o as double[];
     if (xs != null)
     {
         Value[,] vs = new Value[xs.Length, 1];
         for (int c = 0; c < xs.Length; c++)
         {
             vs[c, 0] = NumberValue.Make(xs[c]);
         }
         return(new ArrayExplicit(vs));
     }
     else
     {
         return(ErrorValue.argTypeError);
     }
 }
Example #3
0
		public CGNumberConst(NumberValue number) { this.number = number; }
Example #4
0
 public override Value this[int col, int row] {
     get { return(NumberValue.Make(matrix[row, col])); }
 }
Example #5
0
		private NumberCell(NumberCell cell) { value = cell.value; }
Example #6
0
		public readonly NumberValue value; // Non-null

		public NumberCell(double d) {
			Debug.Assert(!Double.IsNaN(d) && !Double.IsInfinity(d));
			value = (NumberValue)NumberValue.Make(d);
		}
Example #7
0
        public static Object ToSingle(Value v)
        {
            NumberValue nv = v as NumberValue;

            return(nv != null ? (Object)(float)nv.value : null);            // Causes boxing
        }
Example #8
0
        public static Object ToBoolean(Value v)
        {
            NumberValue nv = v as NumberValue;

            return(nv != null ? (Object)(nv.value != 0) : null);            // Causes boxing
        }
Example #9
0
        public static Object ToByte(Value v)
        {
            NumberValue nv = v as NumberValue;

            return(nv != null ? (Object)(byte)nv.value : null);            // Causes boxing
        }
Example #10
0
        public static Object ToUInt16(Value v)
        {
            NumberValue nv = v as NumberValue;

            return(nv != null ? (Object)(ushort)nv.value : null);            // Causes boxing
        }
Example #11
0
        public static Object ToInt32(Value v)
        {
            NumberValue nv = v as NumberValue;

            return(nv != null ? (Object)(int)nv.value : null);            // Causes boxing
        }