|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--viceroy.misc.typeSafeCollections.TypeSafeCollection
|
+--viceroy.misc.typeSafeCollections.TypeSafeSet
Implementation of the java.util.Set class which accepts only objects of a given type for add operations. Is backed by another implementation of Set.
| Field Summary | |
private java.util.Set |
_set
|
| Constructor Summary | |
TypeSafeSet(java.util.Set set,
java.lang.Class type)
Constructs a new TypeSafeSet object. |
|
| Method Summary | |
boolean |
add(java.lang.Object o)
see java.util.Collection Checks the type of the object. |
boolean |
addAll(java.util.Collection c)
see java.util.Collection Checks the type of the objects in the Collection. |
protected void |
checkType(java.lang.Object o)
Tests whether the an object is an instance of the allowed type. |
void |
clear()
see java.util.Collection |
boolean |
contains(java.lang.Object o)
see java.util.Collection |
boolean |
containsAll(java.util.Collection c)
see java.util.Collection |
boolean |
equals(java.lang.Object o)
see java.util.Collection |
protected java.lang.Class |
getType()
Returns the type of objects which can be added to this collection |
boolean |
isEmpty()
see java.util.Collection |
java.util.Iterator |
iterator()
see java.util.Collection |
boolean |
remove(java.lang.Object o)
see java.util.Collection |
boolean |
removeAll(java.util.Collection c)
see java.util.Collection |
boolean |
retainAll(java.util.Collection c)
see java.util.Collection |
int |
size()
see java.util.Collection |
java.lang.Object[] |
toArray()
see java.util.Collection |
java.lang.Object[] |
toArray(java.lang.Object[] a)
see java.util.Collection |
java.lang.String |
toString()
Returns a string representation of the TypeSafeCollection. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Set |
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
| Field Detail |
private java.util.Set _set
| Constructor Detail |
public TypeSafeSet(java.util.Set set,
java.lang.Class type)
set - the Set to be wrappedtype - the type of the objects which can be added| Method Detail |
protected void checkType(java.lang.Object o)
o - The object to be checked
java.lang.ClassCastException - if the object is not of the right typeprotected java.lang.Class getType()
public int size()
size in interface java.util.Collectionpublic boolean isEmpty()
isEmpty in interface java.util.Collectionpublic boolean contains(java.lang.Object o)
contains in interface java.util.Collectionpublic java.util.Iterator iterator()
iterator in interface java.util.Collectionpublic java.lang.Object[] toArray()
toArray in interface java.util.Collectionpublic java.lang.Object[] toArray(java.lang.Object[] a)
toArray in interface java.util.Collectionpublic boolean add(java.lang.Object o)
add in interface java.util.Collectionpublic boolean remove(java.lang.Object o)
remove in interface java.util.Collectionpublic boolean containsAll(java.util.Collection c)
containsAll in interface java.util.Collectionpublic boolean addAll(java.util.Collection c)
addAll in interface java.util.Collectionpublic boolean removeAll(java.util.Collection c)
removeAll in interface java.util.Collectionpublic boolean retainAll(java.util.Collection c)
retainAll in interface java.util.Collectionpublic void clear()
clear in interface java.util.Collectionpublic boolean equals(java.lang.Object o)
equals in interface java.util.Collectionequals in class java.lang.Objectpublic 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 | |||||||||