groovy.lang
Class ObjectRange

java.lang.Object
  extended by java.util.AbstractCollection
      extended by java.util.AbstractList
          extended by groovy.lang.ObjectRange
All Implemented Interfaces:
Range, Iterable, Collection, List

public class ObjectRange
extends AbstractList
implements Range

Represents an inclusive list of objects from a value to a value using comparators

Version:
$Revision: 4290 $
Author:
James Strachan

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
ObjectRange(Comparable from, Comparable to)
           
ObjectRange(Comparable from, Comparable to, boolean reverse)
           
 
Method Summary
 boolean contains(Comparable value)
           
 boolean contains(Object value)
           
protected  Object decrement(Object value)
           
 boolean equals(List that)
           
 boolean equals(Object that)
           
 boolean equals(ObjectRange that)
           
 Object get(int index)
           
 Comparable getFrom()
           
 Comparable getTo()
           
 int hashCode()
           
protected  Object increment(Object value)
           
 String inspect()
           
 boolean isReverse()
           
 Iterator iterator()
           
 int size()
           
 List step(int step)
           
 void step(int step, Closure closure)
           
 List subList(int fromIndex, int toIndex)
           
 String toString()
           
 
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
 

Constructor Detail

ObjectRange

public ObjectRange(Comparable from,
                   Comparable to)

ObjectRange

public ObjectRange(Comparable from,
                   Comparable to,
                   boolean reverse)
Method Detail

hashCode

public int hashCode()
Specified by:
hashCode in interface Collection
Specified by:
hashCode in interface List
Overrides:
hashCode in class AbstractList

equals

public boolean equals(Object that)
Specified by:
equals in interface Collection
Specified by:
equals in interface List
Overrides:
equals in class AbstractList

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
Specified by:
get in class AbstractList

iterator

public Iterator iterator()
Specified by:
iterator in interface Iterable
Specified by:
iterator in interface Collection
Specified by:
iterator in interface List
Overrides:
iterator in class AbstractList

size

public int size()
Specified by:
size in interface Collection
Specified by:
size in interface List
Specified by:
size in class AbstractCollection

subList

public List subList(int fromIndex,
                    int toIndex)
Specified by:
subList in interface List
Overrides:
subList in class AbstractList

toString

public String toString()
Overrides:
toString in class AbstractCollection

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(Object value)
Specified by:
contains in interface Collection
Specified by:
contains in interface List
Overrides:
contains in class AbstractCollection

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-2009 The Codehaus. All Rights Reserved.