groovy.lang
Class ObjectRange
java.lang.Object
java.util.AbstractCollection
java.util.AbstractList
groovy.lang.ObjectRange
- All Implemented Interfaces:
- Range, java.lang.Iterable, java.util.Collection, java.util.List
public class ObjectRange
- extends java.util.AbstractList
- implements Range
Represents an inclusive list of objects from a value to a value using
comparators
- Version:
- $Revision: 4290 $
- Author:
- James Strachan
Fields inherited from class java.util.AbstractList |
modCount |
Constructor Summary |
ObjectRange(java.lang.Comparable from,
java.lang.Comparable to)
|
ObjectRange(java.lang.Comparable from,
java.lang.Comparable to,
boolean reverse)
|
Methods inherited from class java.util.AbstractList |
add, add, addAll, clear, 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, indexOf, isEmpty, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, toArray, toArray |
ObjectRange
public ObjectRange(java.lang.Comparable from,
java.lang.Comparable to)
ObjectRange
public ObjectRange(java.lang.Comparable from,
java.lang.Comparable to,
boolean reverse)
hashCode
public int hashCode()
- Specified by:
hashCode
in interface java.util.Collection
- Specified by:
hashCode
in interface java.util.List
- Overrides:
hashCode
in class java.util.AbstractList
equals
public boolean equals(java.lang.Object that)
- Specified by:
equals
in interface java.util.Collection
- Specified by:
equals
in interface java.util.List
- Overrides:
equals
in class java.util.AbstractList
equals
public boolean equals(ObjectRange that)
equals
public boolean equals(java.util.List that)
getFrom
public java.lang.Comparable getFrom()
- Specified by:
getFrom
in interface Range
- Returns:
- the lower value in the range
getTo
public java.lang.Comparable getTo()
- Specified by:
getTo
in interface Range
- Returns:
- the upper value in the range
isReverse
public boolean isReverse()
- Specified by:
isReverse
in interface Range
- Returns:
- true if this is a reverse range, iterating backwards
starting from the to value and ending on the from value
get
public java.lang.Object get(int index)
- Specified by:
get
in interface java.util.List
- Specified by:
get
in class java.util.AbstractList
iterator
public java.util.Iterator iterator()
- Specified by:
iterator
in interface java.lang.Iterable
- Specified by:
iterator
in interface java.util.Collection
- Specified by:
iterator
in interface java.util.List
- Overrides:
iterator
in class java.util.AbstractList
size
public int size()
- Specified by:
size
in interface java.util.Collection
- Specified by:
size
in interface java.util.List
- Specified by:
size
in class java.util.AbstractCollection
subList
public java.util.List subList(int fromIndex,
int toIndex)
- Specified by:
subList
in interface java.util.List
- Overrides:
subList
in class java.util.AbstractList
toString
public java.lang.String toString()
- Overrides:
toString
in class java.util.AbstractCollection
inspect
public java.lang.String inspect()
- Specified by:
inspect
in interface Range
- Returns:
- the verbose String representation of this Range as would be typed into a console
to create the Range instance
contains
public boolean contains(java.lang.Object value)
- Specified by:
contains
in interface java.util.Collection
- Specified by:
contains
in interface java.util.List
- Overrides:
contains
in class java.util.AbstractCollection
contains
public boolean contains(java.lang.Comparable value)
step
public void step(int step,
Closure closure)
step
public java.util.List step(int step)
increment
protected java.lang.Object increment(java.lang.Object value)
decrement
protected java.lang.Object decrement(java.lang.Object value)
Copyright © 2003-2011 The Codehaus. All Rights Reserved.