Examples of XLNum


Examples of org.boris.xlloop.xloper.XLNum

    public void add(String name, int value) {
        map.put(name, new XLInt(value));
    }

    public void add(String name, double value) {
        map.put(name, new XLNum(value));
    }
View Full Code Here

Examples of org.boris.xlloop.xloper.XLNum

            }
            return new XLArray(a, rows, cols);
        case XLoper.xlTypeNil:
            return XLNil.NIL;
        case XLoper.xlTypeNum:
            return new XLNum(jo.getDouble("num"));
        case XLoper.xlTypeStr:
            return new XLString(jo.getString("str"));
        case XLoper.xlTypeSRef:
            return new XLSRef(jo.getInt("colFirst"), jo.getInt("colLast"), jo.getInt("rowFirst"), jo.getInt("rowLast"));
        }
View Full Code Here

Examples of org.boris.xlloop.xloper.XLNum

        if (obj instanceof String) {
            return new XLString((String) obj);
        } else if (obj instanceof Boolean) {
            return new XLBool(((Boolean) obj).booleanValue());
        } else if (obj instanceof Integer) {
            return new XLNum(((Integer) obj).intValue());
        } else if (obj instanceof Long) {
            return new XLNum(((Long) obj).longValue());
        } else if (obj instanceof Float) {
            return new XLNum(((Float) obj).floatValue());
        } else if (obj instanceof Double) {
            return new XLNum(((Double) obj).doubleValue());
        } else if (obj instanceof String[]) {
            String[] arr = (String[]) obj;
            XLoper[] array = new XLoper[arr.length];
            for (int i = 0; i < arr.length; i++) {
                array[i] = new XLString(arr[i]);
            }

            return new XLArray(array, arr.length, 1);
        } else if (obj instanceof String[][]) {
            String[][] arr = (String[][]) obj;
            if (arr.length == 0 || arr[0] == null)
                return XLError.NA;
            XLArray array = new XLArray(arr.length, arr[0].length);

            for (int i = 0; i < arr.length; i++) {
                for (int j = 0; j < arr[0].length && j < arr[i].length; j++) {
                    array.set(i, j, arr[i][j]);
                }
            }

            return array;
        } else if (obj instanceof double[]) {
            double[] arr = (double[]) obj;
            XLoper[] array = new XLoper[arr.length];

            for (int i = 0; i < arr.length; i++) {
                array[i] = new XLNum(arr[i]);
            }

            return new XLArray(array, array.length, 1);
        } else if (obj instanceof double[][]) {
            double[][] arr = (double[][]) obj;
            if (arr.length == 0 || arr[0] == null)
                return XLError.NA;
            XLArray array = new XLArray(arr.length, arr[0].length);

            for (int i = 0; i < arr.length; i++) {
                for (int j = 0; j < arr[0].length && j < arr[i].length; j++) {
                    array.set(i, j, arr[i][j]);
                }
            }

            return array;
        } else if (obj instanceof Double[]) {
            Double[] arr = (Double[]) obj;
            XLoper[] array = new XLoper[arr.length];

            for (int i = 0; i < arr.length; i++) {
                array[i] = arr[i] == null ? (XLoper) XLNil.NIL : new XLNum(
                        arr[i].doubleValue());
            }

            return new XLArray(array, arr.length, 1);
        } else if (obj instanceof Double[][]) {
View Full Code Here

Examples of org.boris.xlloop.xloper.XLNum

    public void add(String str) {
        list.add(new XLString(str));
    }

    public void add(Double value) {
        list.add(value == null ? (XLoper) XLNil.NIL : (XLoper) new XLNum(value.doubleValue()));
    }
View Full Code Here

Examples of org.boris.xlloop.xloper.XLNum

    public void add(int value) {
        list.add(new XLInt(value));
    }

    public void add(double value) {
        list.add(new XLNum(value));
    }
View Full Code Here

Examples of org.boris.xlloop.xloper.XLNum

    public void set(int row, int column, boolean value) {
        set(row, column, value ? XLBool.TRUE : XLBool.FALSE);
    }

    public void set(int row, int column, double value) {
        set(row, column, new XLNum(value));
    }
View Full Code Here

Examples of org.boris.xlloop.xloper.XLNum

        if (value instanceof StandardLispString) {
            return new XLString(((StandardLispString) value).getValue());
        } else if (value instanceof StandardLispInteger) {
            return new XLInt((int) ((StandardLispInteger) value).getValue());
        } else if (value instanceof StandardLispReal) {
            return new XLNum(((StandardLispReal) value).getDoubleValue());
        } else if (value instanceof StandardLispCons) {
            StandardLispCons c = (StandardLispCons) value;
            XLList coll = new XLList();
            for (int i = 0; i < c.basic_length(); i++) {
                coll.add(makeResult(c.elt(i)));
View Full Code Here

Examples of org.boris.xlloop.xloper.XLNum

        int choice = (int) (Math.random() * 7);
        switch (choice) {
        case 0:
            return new XLString(makeRandomString());
        case 1:
            return new XLNum(Math.random() * 1000);
        case 2:
            return new XLInt((int) (Math.random() * 1000));
        case 3:
            return new XLBool(Math.random() > 0.5);
        case 4:
View Full Code Here

Examples of org.boris.xlloop.xloper.XLNum

        int choice = (int) (Math.random() * 7);
        switch (choice) {
        case 0:
            return new XLString(makeRandomString());
        case 1:
            return new XLNum(Math.random() * 1000);
        case 2:
            return new XLInt((int) (Math.random() * 1000));
        case 3:
            return new XLBool(Math.random() > 0.5);
        case 4:
View Full Code Here

Examples of org.boris.xlloop.xloper.XLNum

        }
        return new XLString(new String(b));
    }

    private static XLoper decodeNum(InputStream is) throws IOException {
        return new XLNum(Double.longBitsToDouble(((long) readDoubleWord(is) << 32) | (long) readDoubleWord(is)));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.