Examples of HGridBuilder


Examples of org.haystack.HGridBuilder

     *            optional username performing the write, otherwise user dis is used
     * @param duration
     *            Number with duration unit if setting level 8
     */
    public HGrid pointWrite(HRef id, int level, String who, HVal val, HNum dur) {
        HGridBuilder b = new HGridBuilder();
        b.addCol("id");
        b.addCol("level");
        b.addCol("who");
        b.addCol("val");
        b.addCol("duration");

        b.addRow(new HVal[] { id, HNum.make(level), HStr.make(who), val, dur });

        HGrid req = b.toGrid();
        HGrid res = call("pointWrite", req);
        return res;
    }
View Full Code Here

Examples of org.haystack.HGridBuilder

     * <li>val: current value at level or null
     * <li>who: who last controlled the value at this level
     * </ul>
     */
    public HGrid pointWriteArray(HRef id) {
        HGridBuilder b = new HGridBuilder();
        b.addCol("id");
        b.addRow(new HVal[] { id });

        HGrid req = b.toGrid();
        HGrid res = call("pointWrite", req);
        return res;
    }
View Full Code Here

Examples of org.haystack.HGridBuilder

     * If HTimeDateRange is passed then must match the timezone configured on
     * the history record. Otherwise if a String is passed, it is resolved
     * relative to the history record's timezone.
     */
    public HGrid hisRead(HRef id, Object range) {
        HGridBuilder b = new HGridBuilder();
        b.addCol("id");
        b.addCol("range");
        b.addRow(new HVal[] { id, HStr.make(range.toString()) });
        HGrid req = b.toGrid();
        HGrid res = call("hisRead", req);
        return res;
    }
View Full Code Here

Examples of org.haystack.HGridBuilder

        return rec;
    }

    @Override
    protected HGrid onReadByIds(HRef[] ids) {
        HGridBuilder b = new HGridBuilder();
        b.addCol("id");
        for (int i = 0; i < ids.length; ++i)
            b.addRow(new HVal[] { ids[i] });
        HGrid req = b.toGrid();
        return call("read", req);
    }
View Full Code Here

Examples of org.haystack.HGridBuilder

        return call("read", req);
    }

    @Override
    protected HGrid onReadAll(String filter, int limit) {
        HGridBuilder b = new HGridBuilder();
        b.addCol("filter");
        b.addCol("limit");
        b.addRow(new HVal[] { HStr.make(filter), HNum.make(limit) });
        HGrid req = b.toGrid();
        return call("read", req);
    }
View Full Code Here

Examples of org.haystack.HGridBuilder

     * - SkySpark: any Axon expression
     *
     * Raise CallErrException if the server raises an exception.
     */
    public HGrid eval(String expr) {
        HGridBuilder b = new HGridBuilder();
        b.addCol("expr");
        b.addRow(new HVal[] { HStr.make(expr) });
        HGrid req = b.toGrid();
        return call("eval", req);
    }
View Full Code Here

Examples of org.haystack.HGridBuilder

    /**
     * Convenience for "evalAll(HGrid, checked)".
     */
    public HGrid[] evalAll(String[] exprs, boolean checked) {
        HGridBuilder b = new HGridBuilder();
        b.addCol("expr");
        for (int i = 0; i < exprs.length; ++i)
            b.addRow(new HVal[] { HStr.make(exprs[i]) });
        return evalAll(b.toGrid(), checked);
    }
View Full Code Here

Examples of org.haystack.HGridBuilder

    //////////////////////////////////////////////////////////////////////////

    /** Read grid from the stream. */
    @Override
    public HGrid readGrid() {
        HGridBuilder b = new HGridBuilder();

        // meta line
        readVer();
        readMeta(b.meta());
        consumeNewline();

        // read cols
        int numCols = 0;
        while (true) {
            String name = readId();
            skipSpace();
            numCols++;
            readMeta(b.addCol(name));
            if (cur != ',')
                break;
            consume();
            skipSpace();
        }
        consumeNewline();

        // rows
        while (cur != '\n' && cur > 0) {
            HVal[] cells = new HVal[numCols];
            for (int i = 0; i < numCols; ++i) {
                skipSpace();
                if (cur != ',' && cur != '\n')
                    cells[i] = readVal();
                skipSpace();
                if (i + 1 < numCols) {
                    if (cur != ',')
                        throw errChar("Expecting comma in row");
                    consume();
                }
            }
            consumeNewline();
            b.addRow(cells);
        }
        if (cur == '\n')
            consumeNewline();

        return b.toGrid();
    }
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.