|
||||||||||
| 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
|
+--viceroy.misc.typeSafeCollections.TypeSafeSortedSet
Implementation of the java.util.SortedSet class which accepts only objects of a given type for add operations. Is backed by another implementation of SortedSet.
| Field Summary | |
private java.util.SortedSet |
_set
|
| Constructor Summary | |
TypeSafeSortedSet(java.util.SortedSet set,
java.lang.Class type)
Constructs a new TypeSafeSortedSet 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 |
java.util.Comparator |
comparator()
see java.util.SortedSet |
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 |
java.lang.Object |
first()
see java.util.SortedSet |
protected java.lang.Class |
getType()
Returns the type of objects which can be added to this collection |
java.util.SortedSet |
headSet(java.lang.Object toElement)
See java.util.SortedSet Returns a type safe java.util.SortedSet |
boolean |
isEmpty()
see java.util.Collection |
java.util.Iterator |
iterator()
see java.util.Collection |
java.lang.Object |
last()
see java.util.SortedSet |
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.util.SortedSet |
subSet(java.lang.Object fromElement,
java.lang.Object toElement)
See java.util.SortedSet Returns a type safe java.util.SortedSet |
java.util.SortedSet |
tailSet(java.lang.Object fromElement)
See java.util.SortedSet Returns a type safe java.util.SortedSet |
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.SortedSet _set
| Constructor Detail |
public TypeSafeSortedSet(java.util.SortedSet set,
java.lang.Class type)
set - the SortedSet to be wrappedtype - the type of the objects which can be added| Method Detail |
public java.util.Comparator comparator()
comparator in interface java.util.SortedSetpublic java.lang.Object first()
first in interface java.util.SortedSetpublic java.lang.Object last()
last in interface java.util.SortedSetpublic java.util.SortedSet headSet(java.lang.Object toElement)
headSet in interface java.util.SortedSet
public java.util.SortedSet subSet(java.lang.Object fromElement,
java.lang.Object toElement)
subSet in interface java.util.SortedSetpublic java.util.SortedSet tailSet(java.lang.Object fromElement)
tailSet in interface java.util.SortedSetprotected 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 | |||||||||