コード例 #1
0
ファイル: Slice.java プロジェクト: BoiseState/TPO-DP
 /**
  * Obtain an interval which contains all of the elements of the slice that are equal to the
  * argument.
  *
  * @param constant the type that all constants in the interval must be equal to
  * @return an interval comprising either exactly the type passed in or no types at all
  */
 public Interval<Constant> getEqualityInterval(Constant constant) {
   if (order.contains(constant)) {
     Iterator<Constant> succession = order.iterator(constant);
     // break this into three lines for clarity
     Constant min = succession.next();
     Constant max = succession.hasNext() ? succession.next() : null;
     return new Interval<Constant>(order, min, max);
   }
   return new Interval<Constant>(order, null, null);
 }
コード例 #2
0
ファイル: Slice.java プロジェクト: BoiseState/TPO-DP
 /**
  * Render the entire slice as single interval.
  *
  * @return an interval that contains every type currently in the slice
  */
 public Interval<Constant> asInterval() {
   return new Interval<Constant>(order, order.iterator().next(), null);
 }