groovy.lang
Class IntRange

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractList
          extended bygroovy.lang.IntRange
All Implemented Interfaces:
Collection, List, Range

public class IntRange
extends AbstractList
implements Range

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

Version:
$Revision: 1.11 $
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(Object value)
           
 boolean equals(IntRange that)
           
 boolean equals(List that)
           
 boolean equals(Object that)
           
 Object get(int index)
           
 Comparable getFrom()
           
 int getFromInt()
           
 Comparable getTo()
           
 int getToInt()
           
 int hashCode()
           
 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

IntRange

public IntRange(int from,
                int to)

IntRange

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

equals

public boolean equals(Object that)
Specified by:
equals in interface List

equals

public boolean equals(List that)

equals

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

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 Object get(int index)
Specified by:
get in interface List

size

public int size()
Specified by:
size in interface List

hashCode

public int hashCode()
Specified by:
hashCode in interface List

iterator

public Iterator iterator()
Specified by:
iterator 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(Object value)
Specified by:
contains in interface List

step

public void step(int step,
                 Closure closure)

step

public List step(int step)


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