/** * 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); }
/** * 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); }