Groovy Documentation

groovy.lang
[Java] Class ObjectRange

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

public class ObjectRange
extends java.util.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.

Authors:
James Strachan
Version:
\$Revision\$


Constructor Summary
ObjectRange(java.lang.Comparable from, java.lang.Comparable to)

Creates a new ObjectRange.

ObjectRange(java.lang.Comparable from, java.lang.Comparable to, boolean reverse)

 
Method Summary
boolean contains(java.lang.Object value)

boolean containsWithinBounds(java.lang.Object value)

Checks whether a value is between the from and to values of a Range

protected java.lang.Object decrement(java.lang.Object value)

boolean equals(java.lang.Object that)

{@inheritDoc}

boolean equals(ObjectRange that)

Compares an ObjectRange to another ObjectRange.

java.lang.Object get(int index)

{@inheritDoc}

java.lang.Comparable getFrom()

{@inheritDoc}

java.lang.Comparable getTo()

{@inheritDoc}

protected java.lang.Object increment(java.lang.Object value)

java.lang.String inspect()

boolean isReverse()

{@inheritDoc}

java.util.Iterator iterator()

{@inheritDoc}

int size()

{@inheritDoc}

void step(int step, Closure closure)

{@inheritDoc}

java.util.List step(int step)

{@inheritDoc}

java.util.List subList(int fromIndex, int toIndex)

{@inheritDoc}

java.lang.String toString()

{@inheritDoc}

 
Methods inherited from class java.util.AbstractList
java.util.AbstractList#add(int, java.lang.Object), java.util.AbstractList#add(java.lang.Object), java.util.AbstractList#remove(int), java.util.AbstractList#get(int), java.util.AbstractList#equals(java.lang.Object), java.util.AbstractList#hashCode(), java.util.AbstractList#indexOf(java.lang.Object), java.util.AbstractList#clear(), java.util.AbstractList#lastIndexOf(java.lang.Object), java.util.AbstractList#subList(int, int), java.util.AbstractList#addAll(int, java.util.Collection), java.util.AbstractList#iterator(), java.util.AbstractList#set(int, java.lang.Object), java.util.AbstractList#listIterator(), java.util.AbstractList#listIterator(int), java.util.AbstractList#remove(java.lang.Object), java.util.AbstractList#toString(), java.util.AbstractList#contains(java.lang.Object), java.util.AbstractList#isEmpty(), java.util.AbstractList#size(), java.util.AbstractList#toArray([Ljava.lang.Object;), java.util.AbstractList#toArray(), java.util.AbstractList#addAll(java.util.Collection), java.util.AbstractList#retainAll(java.util.Collection), java.util.AbstractList#containsAll(java.util.Collection), java.util.AbstractList#removeAll(java.util.Collection), java.util.AbstractList#wait(long, int), java.util.AbstractList#wait(long), java.util.AbstractList#wait(), java.util.AbstractList#getClass(), java.util.AbstractList#notify(), java.util.AbstractList#notifyAll(), java.util.AbstractList#size()
 
Methods inherited from class java.util.AbstractCollection
java.util.AbstractCollection#add(java.lang.Object), java.util.AbstractCollection#remove(java.lang.Object), java.util.AbstractCollection#toString(), java.util.AbstractCollection#clear(), java.util.AbstractCollection#contains(java.lang.Object), java.util.AbstractCollection#isEmpty(), java.util.AbstractCollection#size(), java.util.AbstractCollection#toArray([Ljava.lang.Object;), java.util.AbstractCollection#toArray(), java.util.AbstractCollection#addAll(java.util.Collection), java.util.AbstractCollection#iterator(), java.util.AbstractCollection#retainAll(java.util.Collection), java.util.AbstractCollection#containsAll(java.util.Collection), java.util.AbstractCollection#removeAll(java.util.Collection), java.util.AbstractCollection#wait(long, int), java.util.AbstractCollection#wait(long), java.util.AbstractCollection#wait(), java.util.AbstractCollection#equals(java.lang.Object), java.util.AbstractCollection#hashCode(), java.util.AbstractCollection#getClass(), java.util.AbstractCollection#notify(), java.util.AbstractCollection#notifyAll()
 

Constructor Detail

ObjectRange

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


ObjectRange

public ObjectRange(java.lang.Comparable from, java.lang.Comparable to, boolean reverse)


 
Method Detail

contains

public boolean contains(java.lang.Object value)


containsWithinBounds

public boolean containsWithinBounds(java.lang.Object value)
Checks whether a value is between the from and to values of a Range
Parameters:
value - the value of interest
Returns:
true if the value is within the bounds


decrement

protected java.lang.Object decrement(java.lang.Object value)


equals

public boolean equals(java.lang.Object that)
{@inheritDoc}


equals

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


get

public java.lang.Object get(int index)
{@inheritDoc}


getFrom

public java.lang.Comparable getFrom()
{@inheritDoc}


getTo

public java.lang.Comparable getTo()
{@inheritDoc}


increment

protected java.lang.Object increment(java.lang.Object value)


inspect

public java.lang.String inspect()


isReverse

public boolean isReverse()
{@inheritDoc}


iterator

public java.util.Iterator iterator()
{@inheritDoc}


size

public int size()
{@inheritDoc}


step

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


step

public java.util.List step(int step)
{@inheritDoc}


subList

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


toString

public java.lang.String toString()
{@inheritDoc}


 

Groovy Documentation