Examples of XLArray


Examples of org.boris.xlloop.xloper.XLArray

{
    private static String characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";

    public XLoper execute(IFunctionContext context, String name, XLoper[] args) throws RequestException {
        if (name.equals("RandTest")) {
            XLArray x = new XLArray((int) (Math.random() * 10 + 2), 1);
            for (int i = 0; i < x.length; i++) {
                x.array[i] = makeRandom();
            }
            return x;
        } else if (name.equals("ArrayTest")) {
            // Threads.sleep(15000);
            XLArray x = new XLArray(15, 10);
            for (int i = 0; i < 15; i++) {
                int len = (int) (Math.random() * 10) + 1;
                for (int j = 0; j < len; j++) {
                    x.set(i, j, i * j);
                }
            }
            return x;
        } else if (name.equals("ArgsTest")) {
            return new XLList(args).toXLoper();
View Full Code Here

Examples of org.boris.xlloop.xloper.XLArray

        case 4:
            return new XLString(makeRandomString(0));
        case 5:
            return new XLString(makeRandomString(30, true));
        case 6:
            return new XLArray(2, 1);
        default:
            return XLMissing.MISSING;
        }
    }
View Full Code Here

Examples of org.boris.xlloop.xloper.XLArray

        // CompTest1.makeRandom(), CompTest1.makeRandom() };
        return new XLoper[] { createRandomArray() };
    }

    private static XLoper createRandomArray() {
        XLArray x = new XLArray(15, 10);
        for (int i = 0; i < 15; i++) {
            int len = (int) (Math.random() * 10) + 1;
            for (int j = 0; j < len; j++) {
                x.set(i, j, i * j);
            }
        }
        return x;
    }
View Full Code Here

Examples of org.boris.xlloop.xloper.XLArray

        XLoper[] array = new XLoper[len];
        for (int i = 0; i < len; i++) {
            array[i] = decode(is);
        }

        return new XLArray(array, rows, cols);
    }
View Full Code Here

Examples of org.boris.xlloop.xloper.XLArray

    private XLOper convert(XLoper x) {
        XLOper o = new XLOper();
        if (x instanceof XLArray) {
            o.type = XLOperType.xltypeMulti;
            XLArray a = (XLArray) x;
            o.rows = a.rows;
            o.cols = a.columns;
            o.array = new XLOper[a.array.length];
            for (int i = 0; i < o.array.length; i++) {
                o.array[i] = convert(a.array[i]);
View Full Code Here

Examples of org.boris.xlloop.xloper.XLArray

        case XLOperType.xltypeInt:
            return new XLInt(x.w);
        case XLOperType.xltypeMissing:
            return XLMissing.MISSING;
        case XLOperType.xltypeMulti:
            XLArray a = new XLArray(x.rows, x.cols);
            for (int i = 0; i < x.array.length; i++) {
                a.array[i] = convert(x.array[i]);
            }
            return a;
        case XLOperType.xltypeNil:
View Full Code Here

Examples of org.boris.xlloop.xloper.XLArray

        s.add("hello", 3);
        return s.toXloper();
    }

    public static XLArray makeRandoms(int rows, int cols) {
        XLArray xa = new XLArray(rows, cols);
        for (int i = 0; i < rows; i++) {
            for (int j = 0; j < cols; j++) {
                xa.set(i, j, Math.random());
            }
        }

        return xa;
    }
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.