Examples of HZincReader


Examples of haystack.io.HZincReader

  }

  /** Parse from string fomat "YYYY-MM-DD" or raise ParseException */
  public static HDate make(String s)
  {
    HVal val = new HZincReader(s).readScalar();
    if (val instanceof HDate) return (HDate)val;
    throw new ParseException(s);
  }
View Full Code Here

Examples of haystack.io.HZincReader

    // 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();
      end   = new HZincReader(str.substring(comma+1)).readScalar();
    }

    // figure out what we parsed for start,end
    if (start instanceof HDate)
    {
View Full Code Here

Examples of haystack.io.HZincReader

  }

  /** Parse from string fomat "hh:mm:ss.FF" or raise ParseException */
  public static HTime make(String s)
  {
    HVal val = new HZincReader(s).readScalar();
    if (val instanceof HTime) return (HTime)val;
    throw new ParseException(s);
  }
View Full Code Here

Examples of haystack.io.HZincReader

      ParseException if not formatted correctly */
  public static HFilter make(String s, boolean checked)
  {
    try
    {
      return new HZincReader(s).readFilter();
    }
    catch (Exception e)
    {
      if (!checked) return null;
      if (e instanceof ParseException) throw (ParseException)e;
View Full Code Here

Examples of org.haystack.io.HZincReader

        verifyZinc("dis  :  \"Bob\"  bday : 1970-06-03  marker",
                new HDictBuilder().add("dis", "Bob").add("bday", HDate.make(1970, 6, 3)).add("marker").toDict());
    }

    void verifyZinc(String s, HDict tags) {
        HDict x = new HZincReader(s).readDict();
        if (tags.size() <= 1)
            verifyEq(tags.toZinc(), s);
        verifyEq(x, tags);
    }
View Full Code Here

Examples of org.haystack.io.HZincReader

     * Decode a string into a HFilter; return null or throw
     * ParseException if not formatted correctly
     */
    public static HFilter make(String s, boolean checked) {
        try {
            return new HZincReader(s).readFilter();
        }
        catch (Exception e) {
            if (!checked)
                return null;
            if (e instanceof ParseException)
View Full Code Here

Examples of org.haystack.io.HZincReader

        verifyEq(val.toZinc(), s);
        verifyEq(read(s), val);
    }

    public HVal read(String s) {
        return new HZincReader(s).readScalar();
    }
View Full Code Here

Examples of org.haystack.io.HZincReader

        for (int i = 0; i < cols.length; ++i)
            if (cols[i] == null)
                cols[i] = HDict.EMPTY;

        // read from zinc
        HGrid grid = new HZincReader(str).readGrid();
        verifyGridEq(grid, meta, cols, rows);

        // write grid and verify we can parse that too
        String writeStr = HZincWriter.gridToString(grid);
        HGrid writeGrid = new HZincReader(writeStr).readGrid();
        verifyGridEq(writeGrid, meta, cols, rows);
    }
View Full Code Here

Examples of org.haystack.io.HZincReader

        // 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();
            end = new HZincReader(str.substring(comma + 1)).readScalar();
        }

        // figure out what we parsed for start,end
        if (start instanceof HDate) {
            if (end == null)
View Full Code Here

Examples of org.haystack.io.HZincReader

                c.get(Calendar.MILLISECOND));
    }

    /** Parse from string fomat "hh:mm:ss.FF" or raise ParseException */
    public static HTime make(String s) {
        HVal val = new HZincReader(s).readScalar();
        if (val instanceof HTime)
            return (HTime) val;
        throw new ParseException(s);
    }
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.