Beispiel #1
0
  @Override
  public boolean instantiateTo(int value, ICause cause, boolean informCause)
      throws ContradictionException {
    if (informCause) {
      cause = Cause.Null;
    }
    if (this.instantiated()) {
      if (value != this.getValue()) {
        this.contradiction(cause, MSG_INST);
      }
      return false;
    } else if (contains(value)) {
      // todo: delta
      this.LB.set(value);
      this.UB.set(value);
      this.SIZE.set(1);

      A.updateUpperBound(value, this, false);
      B.updateUpperBound(value, this, false);
      if (!A.contains(value)) {
        B.instantiateTo(value, this, false);
      }
      if (!B.contains(value)) {
        A.instantiateTo(value, this, false);
      }

      this.notifyPropagators(EventType.INSTANTIATE, cause);
      return true;
    } else {
      this.contradiction(cause, MSG_UNKNOWN);
      return false;
    }
  }
Beispiel #2
0
 @Override
 public boolean contains(int value) {
   return A.contains(value) || B.contains(value);
 }