|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object polyglot.util.TypedList
public class TypedList
A TypedList is an List which will not allow members not belonging to a given type to be added to a collection. Optionally, it may also present an immutable view. If an attempt is made to change an immutable list, or if an attempt is made to insert an improperly-typed element, an UnsupportedOperationException is thrown. This class is given so that we can present a List for a given class without worrying about outsiders breaking the rep. This is a poor substitute for PolyJ.
Constructor Summary | |
---|---|
TypedList(java.util.List list,
java.lang.Class c,
boolean immutable)
Requires:
|
Method Summary | |
---|---|
void |
add(int idx,
java.lang.Object o)
|
boolean |
add(java.lang.Object o)
|
boolean |
addAll(java.util.Collection coll)
|
boolean |
addAll(int idx,
java.util.Collection coll)
|
static void |
check(java.util.List list,
java.lang.Class c)
Throws an UnsupportedOperationException if any member of
|
void |
clear()
|
java.lang.Object |
clone()
|
boolean |
contains(java.lang.Object o)
|
boolean |
containsAll(java.util.Collection coll)
|
TypedList |
copy()
Copies this list. |
static TypedList |
copy(java.util.List list,
java.lang.Class c,
boolean immutable)
Requires:
|
static TypedList |
copyAndCheck(java.util.List list,
java.lang.Class c,
boolean immutable)
Creates a new TypedList, containing all the elements of
|
boolean |
equals(java.lang.Object o)
|
java.lang.Object |
get(int idx)
|
java.lang.Class |
getAllowedType()
Gets the allowed type for this list. |
int |
hashCode()
|
int |
indexOf(java.lang.Object o)
|
boolean |
isEmpty()
|
java.util.Iterator |
iterator()
|
int |
lastIndexOf(java.lang.Object o)
|
java.util.ListIterator |
listIterator()
|
java.util.ListIterator |
listIterator(int idx)
|
java.lang.Object |
remove(int idx)
|
boolean |
remove(java.lang.Object o)
|
boolean |
removeAll(java.util.Collection coll)
|
boolean |
retainAll(java.util.Collection coll)
|
java.lang.Object |
set(int idx,
java.lang.Object o)
|
int |
size()
|
java.util.List |
subList(int from,
int to)
|
java.lang.Object[] |
toArray()
|
java.lang.Object[] |
toArray(java.lang.Object[] oa)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TypedList(java.util.List list, java.lang.Class c, boolean immutable)
Method Detail |
---|
public static TypedList copy(java.util.List list, java.lang.Class c, boolean immutable)
public static TypedList copyAndCheck(java.util.List list, java.lang.Class c, boolean immutable)
public static void check(java.util.List list, java.lang.Class c)
public java.lang.Class getAllowedType()
public TypedList copy()
public java.lang.Object clone()
clone
in class java.lang.Object
public void add(int idx, java.lang.Object o)
add
in interface java.util.List
public boolean add(java.lang.Object o)
add
in interface java.util.Collection
add
in interface java.util.List
public boolean addAll(int idx, java.util.Collection coll)
addAll
in interface java.util.List
public boolean addAll(java.util.Collection coll)
addAll
in interface java.util.Collection
addAll
in interface java.util.List
public java.util.ListIterator listIterator()
listIterator
in interface java.util.List
public java.util.ListIterator listIterator(int idx)
listIterator
in interface java.util.List
public java.lang.Object set(int idx, java.lang.Object o)
set
in interface java.util.List
public java.util.List subList(int from, int to)
subList
in interface java.util.List
public void clear()
clear
in interface java.util.Collection
clear
in interface java.util.List
public boolean contains(java.lang.Object o)
contains
in interface java.util.Collection
contains
in interface java.util.List
public boolean containsAll(java.util.Collection coll)
containsAll
in interface java.util.Collection
containsAll
in interface java.util.List
public boolean equals(java.lang.Object o)
equals
in interface java.util.Collection
equals
in interface java.util.List
equals
in class java.lang.Object
public java.lang.Object get(int idx)
get
in interface java.util.List
public int hashCode()
hashCode
in interface java.util.Collection
hashCode
in interface java.util.List
hashCode
in class java.lang.Object
public int indexOf(java.lang.Object o)
indexOf
in interface java.util.List
public boolean isEmpty()
isEmpty
in interface java.util.Collection
isEmpty
in interface java.util.List
public java.util.Iterator iterator()
iterator
in interface java.lang.Iterable
iterator
in interface java.util.Collection
iterator
in interface java.util.List
public int lastIndexOf(java.lang.Object o)
lastIndexOf
in interface java.util.List
public java.lang.Object remove(int idx)
remove
in interface java.util.List
public boolean remove(java.lang.Object o)
remove
in interface java.util.Collection
remove
in interface java.util.List
public boolean removeAll(java.util.Collection coll)
removeAll
in interface java.util.Collection
removeAll
in interface java.util.List
public boolean retainAll(java.util.Collection coll)
retainAll
in interface java.util.Collection
retainAll
in interface java.util.List
public int size()
size
in interface java.util.Collection
size
in interface java.util.List
public java.lang.Object[] toArray()
toArray
in interface java.util.Collection
toArray
in interface java.util.List
public java.lang.Object[] toArray(java.lang.Object[] oa)
toArray
in interface java.util.Collection
toArray
in interface java.util.List
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |