/** * Return the integer value minimum value for the bound. * * @throws scale.common.InvalidException if the minimum value for the bound is not statically * known */ public final long getConstMin() throws scale.common.InvalidException { if ((flags & INTMIN) != 0) return minValue; if ((flags & MINCALC) != 0) throw new scale.common.InvalidException( "The number of elements is not known at compile time."); flags |= MINCALC; minValue = scale.common.Lattice.convertToLongValue(min.getConstantValue()); flags |= INTMIN; return minValue; }
/** 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; }