Package org.boris.xlloop.xloper

Examples of org.boris.xlloop.xloper.XLInt


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

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


        case XLoper.xlTypeBool:
            return jo.getBoolean("bool") ? XLBool.TRUE : XLBool.FALSE;
        case XLoper.xlTypeErr:
            return new XLError(jo.getInt("error"));
        case XLoper.xlTypeInt:
            return new XLInt(jo.getInt("int"));
        case XLoper.xlTypeMissing:
            return XLMissing.MISSING;
        case XLoper.xlTypeMulti:
            int rows = jo.getInt("rows");
            int cols = jo.getInt("cols");
View Full Code Here

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

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

            return new XLArray(array, arr.length, 1);
        } else if (obj instanceof int[][]) {
            int[][] arr = (int[][]) 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 Integer[]) {
            Integer[] arr = (Integer[]) obj;
            XLoper[] array = new XLoper[arr.length];

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

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

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

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

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

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

    private XLoper makeResult(LispValue value) {
        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();
View Full Code Here

        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:
            return new XLString(makeRandomString(0));
        case 5:
View Full Code Here

        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:
            return new XLString(makeRandomString(0));
        case 5:
View Full Code Here

    }

    public XLoper execute(String name, XLoper[] args) throws RequestException, IOException {
        connect();
        protocol.send(socket, new XLString(name));
        protocol.send(socket, new XLInt(args.length));
        for (int i = 0; i < args.length; i++) {
            protocol.send(socket, args[i]);
        }
        return receive();
    }
View Full Code Here

    private static XLoper decodeMissing() {
        return XLMissing.MISSING;
    }

    private static XLoper decodeInt(InputStream is) throws IOException {
        return new XLInt((int) readDoubleWord(is));
    }
View Full Code Here

TOP

Related Classes of org.boris.xlloop.xloper.XLInt

Copyright © 2018 www.massapicom. 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.