groovy.lang
Class Sequence
java.lang.Object
java.util.AbstractCollection
java.util.AbstractList
java.util.ArrayList
groovy.lang.Sequence
- All Implemented Interfaces:
- java.lang.Cloneable, java.util.Collection, GroovyObject, java.util.List, java.util.RandomAccess, java.io.Serializable
- Direct Known Subclasses:
- NonEmptySequence
- public class Sequence
- extends java.util.ArrayList
- implements GroovyObject
Represents a sequence of objects which represents zero or many instances of
of objects of a given type. The type can be ommitted in which case any type of
object can be added.
- Version:
- $Revision: 1.3 $
- Author:
- James Strachan
- See Also:
- Serialized Form
Nested classes inherited from class java.util.AbstractList |
|
Fields inherited from class java.util.ArrayList |
|
Fields inherited from class java.util.AbstractList |
modCount |
Method Summary |
void |
add(int index,
java.lang.Object element)
|
boolean |
add(java.lang.Object element)
|
boolean |
addAll(java.util.Collection c)
|
boolean |
addAll(int index,
java.util.Collection c)
|
protected void |
checkCollectionType(java.util.Collection c)
Checks that each member of the given collection are of the correct
type |
protected void |
checkType(java.lang.Object object)
Checks that the given object instance is of the correct type
otherwise a runtime exception is thrown |
void |
clear()
|
boolean |
equals(java.lang.Object that)
|
boolean |
equals(Sequence that)
|
MetaClass |
getMetaClass()
|
java.lang.Object |
getProperty(java.lang.String property)
|
int |
hashCode()
|
java.lang.Object |
invokeMethod(java.lang.String name,
java.lang.Object args)
Invokes the given method |
int |
minimumSize()
|
java.lang.Object |
remove(int index)
|
protected void |
removeRange(int fromIndex,
int toIndex)
|
void |
set(java.util.Collection collection)
Sets the contents of this sequence to that
of the given collection. |
java.lang.Object |
set(int index,
java.lang.Object element)
|
void |
setMetaClass(MetaClass metaClass)
Allows the MetaClass to be replaced with a derived implementation |
void |
setProperty(java.lang.String property,
java.lang.Object newValue)
Sets the given property to the new value |
java.lang.Class |
type()
|
Methods inherited from class java.util.ArrayList |
clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, size, toArray, toArray, trimToSize |
Methods inherited from class java.util.AbstractList |
iterator, listIterator, listIterator, subList |
Methods inherited from class java.util.AbstractCollection |
containsAll, remove, removeAll, retainAll, toString |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.List |
containsAll, iterator, listIterator, listIterator, remove, removeAll, retainAll, subList |
metaClass
private MetaClass metaClass
type
private java.lang.Class type
hashCode
private int hashCode
Sequence
public Sequence()
Sequence
public Sequence(java.lang.Class type)
Sequence
public Sequence(java.lang.Class type,
java.util.List content)
set
public void set(java.util.Collection collection)
- Sets the contents of this sequence to that
of the given collection.
equals
public boolean equals(java.lang.Object that)
- Specified by:
equals
in interface java.util.List
equals
public boolean equals(Sequence that)
hashCode
public int hashCode()
- Specified by:
hashCode
in interface java.util.List
minimumSize
public int minimumSize()
type
public java.lang.Class type()
- Returns:
- the type of the elements in the sequence or null if there is no
type constraint on this sequence
add
public void add(int index,
java.lang.Object element)
- Specified by:
add
in interface java.util.List
add
public boolean add(java.lang.Object element)
- Specified by:
add
in interface java.util.List
addAll
public boolean addAll(java.util.Collection c)
- Specified by:
addAll
in interface java.util.List
addAll
public boolean addAll(int index,
java.util.Collection c)
- Specified by:
addAll
in interface java.util.List
clear
public void clear()
- Specified by:
clear
in interface java.util.List
remove
public java.lang.Object remove(int index)
- Specified by:
remove
in interface java.util.List
removeRange
protected void removeRange(int fromIndex,
int toIndex)
set
public java.lang.Object set(int index,
java.lang.Object element)
- Specified by:
set
in interface java.util.List
invokeMethod
public java.lang.Object invokeMethod(java.lang.String name,
java.lang.Object args)
- Description copied from interface:
GroovyObject
- Invokes the given method
- Specified by:
invokeMethod
in interface GroovyObject
getProperty
public java.lang.Object getProperty(java.lang.String property)
- Specified by:
getProperty
in interface GroovyObject
- Returns:
- the given property
setProperty
public void setProperty(java.lang.String property,
java.lang.Object newValue)
- Description copied from interface:
GroovyObject
- Sets the given property to the new value
- Specified by:
setProperty
in interface GroovyObject
getMetaClass
public MetaClass getMetaClass()
- Specified by:
getMetaClass
in interface GroovyObject
- Returns:
- the metaClass of this instance
setMetaClass
public void setMetaClass(MetaClass metaClass)
- Description copied from interface:
GroovyObject
- Allows the MetaClass to be replaced with a derived implementation
- Specified by:
setMetaClass
in interface GroovyObject
checkCollectionType
protected void checkCollectionType(java.util.Collection c)
- Checks that each member of the given collection are of the correct
type
checkType
protected void checkType(java.lang.Object object)
- Checks that the given object instance is of the correct type
otherwise a runtime exception is thrown
Copyright © 2003-2005 The Codehaus. All Rights Reserved.