/** sets the value field. */
  private void setValue(String lexical, Datatype type) {
    if (value != null) {
      // not the first match.
      doubleMatchError();
      return;
    }

    if (type == null) {
      // this is possible only when we are recovering from errors.
      value = lexical;
      if (com.sun.msv.driver.textui.Debug.debug) System.out.println("no type info available");
    } else value = type.createValue(lexical, owner);
  }
示例#2
0
  public boolean equals(Object o) {
    // Note that equals method of this class *can* be sloppy,
    // since this class does not have a pattern as its child.

    // Therefore datatype vocaburary does not necessarily provide
    // strict equals method.
    if (o.getClass() != this.getClass()) return false;

    ValueExp rhs = (ValueExp) o;

    if (!rhs.dt.equals(dt)) return false;

    return dt.sameValue(value, rhs.value);
  }
 public void checkValid() throws DatatypeException {
   baseType.checkValid(buffer.toString(), context);
 }
 public boolean isValid() {
   return baseType.isValid(buffer.toString(), context);
 }
示例#5
0
 protected final int calcHashCode() {
   return dt.hashCode() + dt.valueHashCode(value);
 }
示例#6
0
 protected ValueExp(Datatype dt, StringPair typeName, Object value) {
   super(dt.hashCode() + dt.valueHashCode(value));
   this.dt = dt;
   this.name = typeName;
   this.value = value;
 }