|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractList
groovy.lang.ObjectRange
public class ObjectRange
Represents an inclusive list of objects from a value to a value using comparators.
This class is similar toIntRange. If you make any changes to this
class, you might consider making parallel changes to IntRange.
| Field Summary |
|---|
| Fields inherited from class java.util.AbstractList |
|---|
modCount |
| Constructor Summary | |
|---|---|
ObjectRange(java.lang.Comparable from,
java.lang.Comparable to)
Creates a new ObjectRange. |
|
ObjectRange(java.lang.Comparable from,
java.lang.Comparable to,
boolean reverse)
|
|
| Method Summary | |
|---|---|
boolean |
contains(java.lang.Object value)
|
boolean |
containsWithinBounds(java.lang.Object value)
Checks whether a value is between the from and to values of a Range |
protected java.lang.Object |
decrement(java.lang.Object value)
Decrements by one |
boolean |
equals(java.lang.Object that)
|
boolean |
equals(ObjectRange that)
Compares an ObjectRange to another ObjectRange. |
java.lang.Object |
get(int index)
|
java.lang.Comparable |
getFrom()
The lower value in the range. |
java.lang.Comparable |
getTo()
The upper value in the range. |
protected java.lang.Object |
increment(java.lang.Object value)
Increments by one |
java.lang.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 |
java.util.Iterator |
iterator()
|
int |
size()
|
java.util.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. |
java.util.List |
subList(int fromIndex,
int toIndex)
|
java.lang.String |
toString()
|
| Methods inherited from class java.util.AbstractList |
|---|
add, add, addAll, clear, hashCode, indexOf, lastIndexOf, listIterator, listIterator, remove, removeRange, set |
| Methods inherited from class java.util.AbstractCollection |
|---|
addAll, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.List |
|---|
add, add, addAll, addAll, clear, containsAll, hashCode, indexOf, isEmpty, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, toArray, toArray |
| Constructor Detail |
|---|
public ObjectRange(java.lang.Comparable from,
java.lang.Comparable to)
ObjectRange. Creates a reversed range if
from < to.
from - the first value in the range.to - the last value in the range.
public ObjectRange(java.lang.Comparable from,
java.lang.Comparable to,
boolean reverse)
| Method Detail |
|---|
public boolean equals(java.lang.Object that)
equals in interface java.util.Collectionequals in interface java.util.Listequals in class java.util.AbstractListpublic boolean equals(ObjectRange that)
ObjectRange to another ObjectRange.
that - the object to check equality with
true if the ranges are equalpublic java.lang.Comparable getFrom()
getFrom in interface Rangepublic java.lang.Comparable getTo()
getTo in interface Rangepublic boolean isReverse()
isReverse in interface Rangetrue if this is a reverse rangepublic java.lang.Object get(int index)
get in interface java.util.Listget in class java.util.AbstractListpublic java.util.Iterator iterator()
iterator in interface java.lang.Iterableiterator in interface java.util.Collectioniterator in interface java.util.Listiterator in class java.util.AbstractListpublic boolean containsWithinBounds(java.lang.Object value)
containsWithinBounds in interface Rangevalue - the value of interest
public int size()
size in interface java.util.Collectionsize in interface java.util.Listsize in class java.util.AbstractCollection
public java.util.List subList(int fromIndex,
int toIndex)
subList in interface java.util.ListsubList in class java.util.AbstractListpublic java.lang.String toString()
toString in class java.util.AbstractCollectionpublic java.lang.String inspect()
inspect in interface RangeString representation of this Range as would be typed into a console
to create the Range instancepublic boolean contains(java.lang.Object value)
contains in interface java.util.Collectioncontains in interface java.util.Listcontains in class java.util.AbstractCollection
public void step(int step,
Closure closure)
step in interface Rangestep - the amount by which to step. If negative, steps through the
range backwards.closure - the Closure to callpublic java.util.List step(int step)
step in interface Rangestep - the amount by which to step. If negative, steps through the
range backwards.
protected java.lang.Object increment(java.lang.Object value)
value - the value to increment
protected java.lang.Object decrement(java.lang.Object value)
value - the value to decrement
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||