groovy.lang
Class IntRange
java.lang.Object
java.util.AbstractCollection
java.util.AbstractList
groovy.lang.IntRange
- All Implemented Interfaces:
- java.util.Collection, java.util.List, Range
- 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: 1.10 $
- Author:
- James Strachan
Nested classes inherited from class java.util.AbstractList |
|
Field Summary |
private int |
from
|
private boolean |
reverse
|
private int |
to
|
Fields inherited from class java.util.AbstractList |
modCount |
Constructor Summary |
|
IntRange(int from,
int to)
|
protected |
IntRange(int from,
int to,
boolean reverse)
|
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 |
from
private int from
to
private int to
reverse
private boolean reverse
IntRange
public IntRange(int from,
int to)
IntRange
protected IntRange(int from,
int to,
boolean reverse)
equals
public boolean equals(java.lang.Object that)
- Specified by:
equals
in interface java.util.List
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
size
public int size()
- Specified by:
size
in interface java.util.List
hashCode
public int hashCode()
- Specified by:
hashCode
in interface java.util.List
iterator
public java.util.Iterator iterator()
- Specified by:
iterator
in interface java.util.List
subList
public java.util.List subList(int fromIndex,
int toIndex)
- Specified by:
subList
in interface java.util.List
toString
public java.lang.String toString()
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.List
step
public void step(int step,
Closure closure)
step
public java.util.List step(int step)
Copyright © 2003-2005 The Codehaus. All Rights Reserved.