Example #1
0
  /** Return true if the types are equivalent. */
  public boolean equivalent(Node tc) {
    if (!(tc instanceof Bound)) return false;

    Bound t2 = (Bound) tc;
    if (this == t2) return true;

    if ((min == t2.min) && (max == t2.max)) return true;

    if ((min == null) || (t2.min == null) || (max == null) || (t2.max == null)) return false;

    Literal b1 =
        scale.common.Lattice.equal(
            min.getCoreType(), min.getConstantValue(), t2.min.getConstantValue());
    Literal b2 =
        scale.common.Lattice.equal(
            max.getCoreType(), max.getConstantValue(), t2.max.getConstantValue());
    try {
      if (!scale.common.Lattice.convertToBooleanValue(b1)) return false;
      if (!scale.common.Lattice.convertToBooleanValue(b2)) return false;
    } catch (scale.common.InvalidException e) {
      return false;
    }
    return true;
  }