コード例 #1
0
ファイル: Bounds.java プロジェクト: ferhaterata/kodkod
 /**
  * Sets the lower and upper bounds for the given relation.
  *
  * @requires lower.tuples in upper.tuples && lower.arity = upper.arity = r.arity && lower.universe
  *     = upper.universe = this.universe
  * @ensures this.relations' = this.relations + r && this.lowerBound' = this.lowerBound ++ r->lower
  *     && this.upperBound' = this.upperBound ++ r->upper
  * @throws NullPointerException r = null || lower = null || upper = null
  * @throws IllegalArgumentException lower.arity != r.arity || upper.arity != r.arity
  * @throws IllegalArgumentException lower.universe != this.universe || upper.universe !=
  *     this.universe
  * @throws IllegalArgumentException lower.tuples !in upper.tuples
  */
 public void bound(Relation r, TupleSet lower, TupleSet upper) {
   if (!upper.containsAll(lower))
     throw new IllegalArgumentException("lower.tuples !in upper.tuples");
   if (upper.size() == lower.size()) {
     // upper.containsAll(lower) && upper.size()==lower.size() => upper.equals(lower)
     boundExactly(r, lower);
   } else {
     checkBound(r.arity(), lower);
     checkBound(r.arity(), upper);
     lowers.put(r, lower.clone().unmodifiableView());
     uppers.put(r, upper.clone().unmodifiableView());
   }
 }
コード例 #2
0
ファイル: Bounds.java プロジェクト: ferhaterata/kodkod
 /**
  * Makes the specified tupleset an exact bound on the relational value that corresponds to the
  * given integer.
  *
  * @requires ibound.arity = 1 && i.bound.size() = 1
  * @ensures this.intBound' = this.intBound' ++ i -> ibound
  * @throws NullPointerException ibound = null
  * @throws IllegalArgumentException ibound.arity != 1 || ibound.size() != 1
  * @throws IllegalArgumentException ibound.universe != this.universe
  */
 public void boundExactly(int i, TupleSet ibound) {
   checkBound(1, ibound);
   if (ibound.size() != 1) throw new IllegalArgumentException("ibound.size != 1: " + ibound);
   intbounds.put(i, ibound.clone().unmodifiableView());
 }
コード例 #3
0
ファイル: Bounds.java プロジェクト: ferhaterata/kodkod
 /**
  * Makes the specified tupleset the upper bound on the contents of the given relation. The lower
  * bound automatically becomen an empty tupleset with the same arity as the relation.
  *
  * @requires upper.arity = r.arity && upper.universe = this.universe
  * @ensures this.relations' = this.relations + r this.lowerBound' = this.lowerBound ++ r->{s:
  *     TupleSet | s.universe = this.universe && s.arity = r.arity && no s.tuples} &&
  *     this.upperBound' = this.upperBound ++ r->upper
  * @throws NullPointerException r = null || upper = null
  * @throws IllegalArgumentException upper.arity != r.arity || upper.universe != this.universe
  */
 public void bound(Relation r, TupleSet upper) {
   checkBound(r.arity(), upper);
   lowers.put(r, factory.noneOf(r.arity()).unmodifiableView());
   uppers.put(r, upper.clone().unmodifiableView());
 }
コード例 #4
0
ファイル: Bounds.java プロジェクト: ferhaterata/kodkod
 /**
  * Sets both the lower and upper bounds of the given relation to the given set of tuples.
  *
  * @requires tuples.arity = r.arity && tuples.universe = this.universe
  * @ensures this.relations' = this.relations + r this.lowerBound' = this.lowerBound' ++ r->tuples
  *     && this.upperBound' = this.lowerBound' ++ r->tuples
  * @throws NullPointerException r = null || tuples = null
  * @throws IllegalArgumentException tuples.arity != r.arity || tuples.universe != this.universe
  */
 public void boundExactly(Relation r, TupleSet tuples) {
   checkBound(r.arity(), tuples);
   final TupleSet unmodifiableTuplesCopy = tuples.clone().unmodifiableView();
   lowers.put(r, unmodifiableTuplesCopy);
   uppers.put(r, unmodifiableTuplesCopy);
 }