|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Range<T extends Comparable>
A Range represents the list of all items obtained by starting from a
from
value and calling next()
successively
until you reach the to
value. For a reverse range,
the list is obtained by starting at the to
value and
successively calling previous()
until the from
value is reached.
Method Summary | |
---|---|
boolean |
containsWithinBounds(Object o)
Indicates whether an object is greater than or equal to the from
value for the range and less than or equal to the to value. |
Comparable |
getFrom()
The lower value in the range. |
Comparable |
getTo()
The upper value in the range. |
String |
inspect()
|
boolean |
isReverse()
Indicates whether this is a reverse range which iterates backwards starting from the to value and ending on the from value |
List |
step(int step)
Forms a list by stepping through the range by the indicated interval. |
void |
step(int step,
Closure closure)
Steps through the range, calling a closure for each number. |
Methods inherited from interface java.util.List |
---|
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, subList, toArray, toArray |
Method Detail |
---|
Comparable getFrom()
Comparable getTo()
boolean isReverse()
true
if this is a reverse rangeboolean containsWithinBounds(Object o)
from
value for the range and less than or equal to the to
value.
o
- the object to check against the boundaries of the range
true
if the object is between the from and to valuesvoid step(int step, Closure closure)
step
- the amount by which to step. If negative, steps through the
range backwards.closure
- the Closure
to callList step(int step)
step
- the amount by which to step. If negative, steps through the
range backwards.
String inspect()
String
representation of this Range
as would be typed into a console
to create the Range
instance
|
Copyright © 2003-2009 The Codehaus. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |