Package org.haystack.tagval

Examples of org.haystack.tagval.HVal


        @Override
        public MapEntry next() {
            if (col >= grid.cols.length)
                throw new NoSuchElementException();
            String name = grid.col(col).name();
            HVal val = cells[col];
            for (col++; col < grid.cols.length; ++col)
                if (cells[col] != null)
                    break;
            return new MapEntry(name, val);
        }
View Full Code Here


        if (str.equals("yesterday"))
            return make(HDate.today().minusDays(1), tz);

        // parse scalars
        int comma = str.indexOf(',');
        HVal start = null, end = null;
        if (comma < 0) {
            start = new HZincReader(str).readScalar();
        }
        else {
            start = new HZincReader(str.substring(0, comma)).readScalar();
View Full Code Here

     * Get display string for this entity:
     * - dis tag
     * - id tag
     */
    public String dis() {
        HVal v;
        v = get("dis", false);
        if (v instanceof HStr)
            return ((HStr) v).val;
        v = get("id", false);
        if (v != null)
            return v.toString();
        return "????";
    }
View Full Code Here

        StringBuffer s = new StringBuffer();
        boolean first = true;
        for (Iterator<Entry<String, HVal>> it = iterator(); it.hasNext();) {
            Entry<String, HVal> e = it.next();
            String name = e.getKey();
            HVal val = e.getValue();
            if (first)
                first = false;
            else
                s.append(' ');
            s.append(name);
            if (val != HMarker.VAL) {
                s.append(':').append(val.toZinc());
            }
        }
        return s.toString();
    }
View Full Code Here

            return map.size();
        }

        @Override
        public HVal get(String name, boolean checked) {
            HVal val = map.get(name);
            if (val != null)
                return val;
            if (!checked)
                return null;
            throw new UnknownNameException(name);
View Full Code Here

        while (it.hasNext()) {
            Entry<String, String[]> entry = it.next();
            String name = entry.getKey();
            String valStr = entry.getValue()[0];

            HVal val;
            try {
                val = new HZincReader(valStr).readScalar();
            }
            catch (Exception e) {
                val = HStr.make(valStr);
View Full Code Here

    }

    HRef[] gridToIds(HServer db, HGrid grid) {
        HRef[] ids = new HRef[grid.numRows()];
        for (int i = 0; i < ids.length; ++i) {
            HVal val = grid.row(i).get("id");
            ids[i] = valToId(db, val);
        }
        return ids;
    }
View Full Code Here

        HDate date = HDate.make(2010, 6, 7);
        HTimeZone tz = HTimeZone.make(kw.getStr("tz"));
        HHisItem[] write = new HHisItem[5];
        for (int i = 0; i < write.length; ++i) {
            HDateTime ts = HDateTime.make(date, HTime.make(i + 1, 0), tz);
            HVal val = HNum.make(i, "kW");
            write[i] = HHisItem.make(ts, val);
        }

        // write and verify
        client.hisWrite(kw.id(), write);
View Full Code Here

    }

    void verifyGridContains(HGrid g, String col, HVal val) {
        boolean found = false;
        for (int i = 0; i < g.numRows(); ++i) {
            HVal x = g.row(i).get(col, false);
            if (x != null && x.equals(val)) {
                found = true;
                break;
            }
        }
        if (!found) {
View Full Code Here

    }

    @Override
    public void writeRow(HCol[] cols, HRow row, int index) {
        for (int i = 0; i < cols.length; ++i) {
            HVal val = row.get(cols[i], false);
            if (i > 0)
                out.write(',');
            if (val == null) {
                if (i == 0)
                    out.write('N');
            }
            else {
                out.write(val.toZinc());
            }
        }

        out.write('\n');
    }
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.