|
|||||||||
| 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(Comparable from,
Comparable to)
Creates a new ObjectRange. |
|
ObjectRange(Comparable from,
Comparable to,
boolean reverse)
|
|
| Method Summary | |
|---|---|
boolean |
contains(Object value)
|
boolean |
containsWithinBounds(Object value)
Checks whether a value is between the from and to values of a Range |
protected Object |
decrement(Object value)
Decrements by one |
boolean |
equals(Object that)
|
boolean |
equals(ObjectRange that)
Compares an ObjectRange to another ObjectRange. |
Object |
get(int index)
|
Comparable |
getFrom()
The lower value in the range. |
Comparable |
getTo()
The upper value in the range. |
protected Object |
increment(Object value)
Increments by one |
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 |
Iterator |
iterator()
|
int |
size()
|
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. |
List |
subList(int fromIndex,
int toIndex)
|
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(Comparable from,
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(Comparable from,
Comparable to,
boolean reverse)
| Method Detail |
|---|
public boolean equals(Object that)
equals in interface Collectionequals in interface Listequals in class AbstractListpublic boolean equals(ObjectRange that)
ObjectRange to another ObjectRange.
that - the object to check equality with
true if the ranges are equalpublic Comparable getFrom()
getFrom in interface Rangepublic Comparable getTo()
getTo in interface Rangepublic boolean isReverse()
isReverse in interface Rangetrue if this is a reverse rangepublic Object get(int index)
get in interface Listget in class AbstractListpublic Iterator iterator()
iterator in interface Iterableiterator in interface Collectioniterator in interface Listiterator in class AbstractListpublic boolean containsWithinBounds(Object value)
containsWithinBounds in interface Rangevalue - the value of interest
public int size()
size in interface Collectionsize in interface Listsize in class AbstractCollection
public List subList(int fromIndex,
int toIndex)
subList in interface ListsubList in class AbstractListpublic String toString()
toString in class AbstractCollectionpublic String inspect()
inspect in interface RangeString representation of this Range as would be typed into a console
to create the Range instancepublic boolean contains(Object value)
contains in interface Collectioncontains in interface Listcontains in class 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 List step(int step)
step in interface Rangestep - the amount by which to step. If negative, steps through the
range backwards.
protected Object increment(Object value)
value - the value to increment
protected Object decrement(Object value)
value - the value to decrement
|
Copyright © 2003-2009 The Codehaus. All rights reserved. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||