Package org.haystack.tagval

Examples of org.haystack.tagval.HVal


        return name;
    }

    /** Return display name of column which is meta.dis or name */
    public String dis() {
        HVal dis = meta.get("dis", false);
        if (dis instanceof HStr)
            return ((HStr) dis).val;
        return name;
    }
View Full Code Here


        Iterator<Entry<String, HVal>> it = dict.iterator();
        List<HVal> cells = new ArrayList<HVal>();
        while (it.hasNext()) {
            Entry<String, HVal> entry = it.next();
            String name = entry.getKey();
            HVal val = entry.getValue();
            b.addCol(name);
            cells.add(val);
        }
        b.rows.add(cells.toArray(new HVal[cells.size()]));
        return b.toGrid();
View Full Code Here

        boolean isBool = ((HStr) entity.get("kind")).val.equals("Bool");
        int count = 0;
        HVal[] values = new HVal[2];
        HRow row = new HRow(null, values);
        while (ts.compareTo(range.end) <= 0) {
            HVal val = isBool ? (HVal) HBool.make(count % 2 == 0) : (HVal) HNum.make(count);
            if (ts != range.start) {
                values[0] = val;
                values[1] = ts;
                writer.writeRow(cols, row, count++);
            }
View Full Code Here

    @Override
    public void onService(HServer db, HGrid req, HGridWriter writer) throws Exception {
        // ensure we have one row
        String navId = null;
        if (!req.isEmpty()) {
            HVal val = req.row(0).get("navId", false);
            if (val instanceof HStr)
                navId = ((HStr) val).val;
        }
        writeGrid(writer, db.nav(navId));
    }
View Full Code Here

        // check for write
        if (row.has("level")) {
            int level = row.getInt("level");
            String who = row.getStr("who"); // be nice to have user fallback
            HVal val = row.get("val", false);
            HNum dur = (HNum) row.get("duration", false);
            db.pointWrite(id, level, val, who, dur);
        }

        writeGrid(writer, db.pointWriteArray(id));
View Full Code Here

        super(msg(grid));
        this.grid = grid;
    }

    private static String msg(HGrid grid) {
        HVal dis = grid.meta().get("dis", false);
        if (dis instanceof HStr)
            return ((HStr) dis).val;
        return "server side error";
    }
View Full Code Here

    /** Error grid returned by server */
    public final HGrid grid;

    /** Get the server side stack trace or return null if not available */
    public String trace() {
        HVal val = grid.meta().get("errTrace", false);
        if (val instanceof HStr)
            return ((HStr) val).toString();
        return null;
    }
View Full Code Here

            path = p;
        }

        @Override
        public final boolean include(HDict dict, Pather pather) {
            HVal val = dict.get(path.get(0), false);
            if (path.size() != 1) {
                HDict nt = dict;
                for (int i = 1; i < path.size(); ++i) {
                    if (!(val instanceof HRef)) {
                        val = null;
View Full Code Here

     */
    @Override
    public HVal get(String name, boolean checked) {
        HCol col = grid.col(name, false);
        if (col != null) {
            HVal val = cells[col.index];
            if (val != null)
                return val;
        }
        if (checked)
            throw new UnknownNameException(name);
View Full Code Here

    /**
     * Get a cell by column. If cell is null then raise
     * UnknownNameException or return null based on checked flag.
     */
    public HVal get(HCol col, boolean checked) {
        HVal val = cells[col.index];
        if (val != null)
            return val;
        if (checked)
            throw new UnknownNameException(col.name());
        return null;
View Full Code Here

TOP

Related Classes of org.haystack.tagval.HVal

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.