groovy.lang
Class ObjectRange
java.lang.Object
java.util.AbstractCollection
java.util.AbstractList
groovy.lang.ObjectRange
- All Implemented Interfaces:
- Collection, List, Range
- public class ObjectRange
- extends AbstractList
- implements Range
Represents an inclusive list of objects from a value to a value using
comparators
- Version:
- $Revision: 1.15 $
- Author:
- James Strachan
Methods inherited from class java.util.AbstractList |
add, add, addAll, clear, indexOf, lastIndexOf, listIterator, listIterator, remove, removeRange, set |
Methods inherited from interface java.util.List |
add, add, addAll, addAll, clear, contains, containsAll, indexOf, isEmpty, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, toArray, toArray |
ObjectRange
public ObjectRange(Comparable from,
Comparable to)
ObjectRange
public ObjectRange(Comparable from,
Comparable to,
boolean reverse)
hashCode
public int hashCode()
- Specified by:
hashCode
in interface List
equals
public boolean equals(Object that)
- Specified by:
equals
in interface List
equals
public boolean equals(ObjectRange that)
equals
public boolean equals(List that)
getFrom
public Comparable getFrom()
- Specified by:
getFrom
in interface Range
- Returns:
- the lower value in the range
getTo
public 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 Object get(int index)
- Specified by:
get
in interface List
iterator
public Iterator iterator()
- Specified by:
iterator
in interface List
size
public int size()
- Specified by:
size
in interface List
subList
public List subList(int fromIndex,
int toIndex)
- Specified by:
subList
in interface List
toString
public String toString()
inspect
public 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(Comparable value)
step
public void step(int step,
Closure closure)
step
public List step(int step)
increment
protected Object increment(Object value)
decrement
protected Object decrement(Object value)
Copyright © 2003-2005 The Codehaus. All Rights Reserved.