groovy.lang
Class EmptyRange

java.lang.Object
  extended by groovy.lang.EmptyRange
All Implemented Interfaces:
Range, Iterable, Collection, List

public class EmptyRange
extends Object
implements Range

Constructing Ranges like 0..<0

Author:
Dierk Koenig

Field Summary
protected  Comparable at
           
protected  List EMPTY_LIST
           
 
Constructor Summary
EmptyRange(Comparable at)
           
 
Method Summary
 void add(int index, Object element)
           
 boolean add(Object o)
           
 boolean addAll(Collection c)
           
 boolean addAll(int index, Collection c)
           
 void clear()
           
 boolean contains(Object o)
           
 boolean containsAll(Collection c)
           
 Object get(int index)
           
 Comparable getFrom()
           
 Comparable getTo()
           
 int indexOf(Object o)
           
 String inspect()
           
 boolean isEmpty()
           
 boolean isReverse()
           
 Iterator iterator()
           
 int lastIndexOf(Object o)
           
 ListIterator listIterator()
           
 ListIterator listIterator(int index)
           
 Object remove(int index)
           
 boolean remove(Object o)
           
 boolean removeAll(Collection c)
           
 boolean retainAll(Collection c)
           
 Object set(int index, Object element)
           
 int size()
           
 List step(int step)
           
 void step(int step, Closure closure)
           
 List subList(int fromIndex, int toIndex)
           
 Object[] toArray()
           
 Object[] toArray(Object[] a)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
equals, hashCode
 

Field Detail

at

protected Comparable at

EMPTY_LIST

protected final List EMPTY_LIST
Constructor Detail

EmptyRange

public EmptyRange(Comparable at)
Method Detail

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

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

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

toString

public String toString()
Overrides:
toString in class Object

size

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

clear

public void clear()
Specified by:
clear in interface Collection
Specified by:
clear in interface List

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection
Specified by:
isEmpty in interface List

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection
Specified by:
toArray in interface List

get

public Object get(int index)
Specified by:
get in interface List

remove

public Object remove(int index)
Specified by:
remove in interface List

add

public void add(int index,
                Object element)
Specified by:
add in interface List
Throws:
UnsupportedOperationException

indexOf

public int indexOf(Object o)
Specified by:
indexOf in interface List

lastIndexOf

public int lastIndexOf(Object o)
Specified by:
lastIndexOf in interface List

add

public boolean add(Object o)
Specified by:
add in interface Collection
Specified by:
add in interface List
Throws:
UnsupportedOperationException

contains

public boolean contains(Object o)
Specified by:
contains in interface Collection
Specified by:
contains in interface List

remove

public boolean remove(Object o)
Specified by:
remove in interface Collection
Specified by:
remove in interface List

addAll

public boolean addAll(int index,
                      Collection c)
Specified by:
addAll in interface List
Throws:
UnsupportedOperationException

addAll

public boolean addAll(Collection c)
Specified by:
addAll in interface Collection
Specified by:
addAll in interface List
Throws:
UnsupportedOperationException

containsAll

public boolean containsAll(Collection c)
Specified by:
containsAll in interface Collection
Specified by:
containsAll in interface List

removeAll

public boolean removeAll(Collection c)
Specified by:
removeAll in interface Collection
Specified by:
removeAll in interface List

retainAll

public boolean retainAll(Collection c)
Specified by:
retainAll in interface Collection
Specified by:
retainAll in interface List

iterator

public Iterator iterator()
Specified by:
iterator in interface Iterable
Specified by:
iterator in interface Collection
Specified by:
iterator in interface List

subList

public List subList(int fromIndex,
                    int toIndex)
Specified by:
subList in interface List

listIterator

public ListIterator listIterator()
Specified by:
listIterator in interface List

listIterator

public ListIterator listIterator(int index)
Specified by:
listIterator in interface List

set

public Object set(int index,
                  Object element)
Specified by:
set in interface List
Throws:
UnsupportedOperationException

toArray

public Object[] toArray(Object[] a)
Specified by:
toArray in interface Collection
Specified by:
toArray in interface List

step

public void step(int step,
                 Closure closure)

step

public List step(int step)


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