Example #1
0
 private Bound(Expression min, Expression max) {
   this.flags = NORMAL;
   setMin(min);
   setMax(max);
   if (bounds == null) bounds = new Vector<Bound>(10);
   bounds.addElement(this);
 }
Example #2
0
  /**
   * Create a representation of a range from min to max.
   *
   * @param min is the lower bound
   * @param max is the upper bound
   */
  public static Bound create(Expression min, Expression max) {
    if (max == null) {
      if (min == null) return noBound;
      max = LiteralMap.put(0x7ffffff, Machine.currentMachine.getIntegerCalcType());
    }

    if (bounds != null) {
      int n = bounds.size();
      for (int i = 0; i < n; i++) {
        Bound ta = bounds.elementAt(i);

        if (!min.equivalent(ta.min)) continue;

        if (!max.equivalent(ta.max)) continue;

        return ta;
      }
    }
    Bound a = new Bound(min, max);
    return a;
  }