Groovy 1.7.0

groovy.lang
Class ObjectRange

java.lang.Object
  java.util.AbstractCollection
      java.util.AbstractList
          groovy.lang.ObjectRange
All Implemented Interfaces:
Range

class ObjectRange
extends AbstractList

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

This class is similar to IntRange. If you make any changes to this class, you might consider making parallel changes to IntRange.

author:
James Strachan
version:
$Revision: 13469 $


Constructor Summary
ObjectRange(Comparable from, Comparable to)

Creates a new {

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 {

Object get(int index)

{

Comparable getFrom()

{

Comparable getTo()

{

protected Object increment(Object value)

Increments by one

String inspect()

{

boolean isReverse()

{

Iterator iterator()

{

int size()

{

void step(int step, Closure closure)

{

List step(int step)

{

List subList(int fromIndex, int toIndex)

{

String toString()

{

 
Methods inherited from class AbstractList
add, add, get, hashCode, indexOf, clear, equals, lastIndexOf, addAll, iterator, remove, set, listIterator, listIterator, subList, toString, contains, isEmpty, addAll, size, toArray, toArray, remove, containsAll, removeAll, retainAll, wait, wait, wait, getClass, notify, notifyAll, size
 
Methods inherited from class AbstractCollection
add, clear, toString, contains, isEmpty, addAll, iterator, size, toArray, toArray, remove, containsAll, removeAll, retainAll, wait, wait, wait, hashCode, getClass, equals, notify, notifyAll
 
Methods inherited from class Object
wait, wait, wait, hashCode, getClass, equals, toString, notify, notifyAll
 

Constructor Detail

ObjectRange

public ObjectRange(Comparable from, Comparable to)
Creates a new ObjectRange. Creates a reversed range if from < to.
param:
from the first value in the range.
param:
to the last value in the range.


ObjectRange

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


 
Method Detail

contains

public boolean contains(Object value)


containsWithinBounds

public boolean containsWithinBounds(Object value)
Checks whether a value is between the from and to values of a Range
param:
value the value of interest
return:
true if the value is within the bounds


decrement

protected Object decrement(Object value)
Decrements by one
param:
value the value to decrement
return:
the decremented value


equals

public boolean equals(Object that)
{@inheritDoc}


equals

public boolean equals(ObjectRange that)
Compares an ObjectRange to another ObjectRange.
param:
that the object to check equality with
return:
true if the ranges are equal


get

public Object get(int index)
{@inheritDoc}


getFrom

public Comparable getFrom()
{@inheritDoc}


getTo

public Comparable getTo()
{@inheritDoc}


increment

protected Object increment(Object value)
Increments by one
param:
value the value to increment
return:
the incremented value


inspect

public String inspect()
{@inheritDoc}


isReverse

public boolean isReverse()
{@inheritDoc}


iterator

public Iterator iterator()
{@inheritDoc}


size

public int size()
{@inheritDoc}


step

public void step(int step, Closure closure)
{@inheritDoc}


step

public List step(int step)
{@inheritDoc}


subList

public List subList(int fromIndex, int toIndex)
{@inheritDoc}


toString

public String toString()
{@inheritDoc}


 

Copyright © 2003-2009 The Codehaus. All rights reserved.