groovy.lang
Class IntRange

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

public class IntRange
extends java.util.AbstractList
implements Range

Represents a list of Integer objects from a specified int up to and including a given and to.

Version:
$Revision: 4098 $
Author:
James Strachan

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

IntRange

public IntRange(int from,
                int to)

IntRange

protected IntRange(int from,
                   int to,
                   boolean reverse)
Method Detail

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(java.util.List that)

equals

public boolean equals(IntRange 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

getFromInt

public int getFromInt()

getToInt

public int getToInt()

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

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

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

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

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

step

public void step(int step,
                 Closure closure)

step

public java.util.List step(int step)


Copyright © 2003-2011 The Codehaus. All Rights Reserved.