Beispiel #1
0
  public Bound max(Bound aBound) {

    if (equals(MAX)) {
      return this;
    }

    if (aBound.equals(MAX)) {
      return aBound;
    }

    if (this.value.max(aBound.getValue()).equals(this.value)) {
      return this;
    } else {
      return aBound;
    }
  }
Beispiel #2
0
  public Bound subtract(Bound bound) {

    if (bound == null) {
      throw new InternalError("value shouldn't be null");
    }

    if (equals(MAX) && bound.equals(MAX) || equals(MIN) && bound.equals(MIN)) {
      throw new InternalError("Canno't subtract + infinite and - infinite");
    }

    if (bound.equals(MAX) || equals(MIN)) {
      return MIN;
    } else if (bound.equals(MIN) || equals(MAX)) {
      return MAX;
    } else {
      return new Bound(this.value.subtract(bound.getValue()));
    }
  }