Example #1
0
  /**
   * Create a representation of a range from <code>min</code> to <code>max</code>. If <code>
   * min &gt; max</code>, the bound is considered to be unbounded.
   *
   * @param min the lower bound
   * @param max the upper bound
   */
  public static Bound create(long min, long max) {
    if (min > max) return noBound;

    IntegerType intType = Machine.currentMachine.getIntegerCalcType();
    Literal lit0 = LiteralMap.put(min, intType);
    Literal litn = LiteralMap.put(max, intType);
    return create(lit0, litn);
  }
Example #2
0
 private Bound(long min, long max, long numberOfElements, int flags) {
   IntegerType intType = Machine.currentMachine.getIntegerCalcType();
   this.min = LiteralMap.put(min, intType);
   this.minValue = min;
   this.max = LiteralMap.put(max, intType);
   this.maxValue = max;
   this.numberOfElements = numberOfElements;
   this.flags = flags;
 }
Example #3
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;
  }