Exemple #1
0
    /**
     * The <code>set()</code> method updates the value of the option.
     *
     * @param val a string representation of the new value of the option.
     */
    @Override
    public void set(String val) {
      CharacterIterator iter = new StringCharacterIterator(val);
      try {
        // check for leading [
        if (!StringUtil.peekAndEat(iter, '[')) parseError(name, "interval", val);

        String lstr = StringUtil.readDecimalString(iter, 12);
        low = java.lang.Long.parseLong(lstr);

        // check for ',' separator
        if (!StringUtil.peekAndEat(iter, ',')) parseError(name, "interval", val);

        String hstr = StringUtil.readDecimalString(iter, 12);
        high = java.lang.Long.parseLong(hstr);

        // check for trailing ]
        if (!StringUtil.peekAndEat(iter, ']')) parseError(name, "interval", val);

      } catch (NumberFormatException e) {
        // in case of NumberFormatException
        parseError(name, "interval", val);
      }
    }