|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractSet<E>
java.util.HashSet
nl.knowledgeplaza.util.collection.ObservableSet
public class ObservableSet
The ObservableSet subclasses the HashSet and overrides all the functions that change the internally stored collection. In the overridden function, it simply calls the super class's function and fires a CollectionEvent to let observers know the collection has changed.
| Field Summary | |
|---|---|
protected java.util.ArrayList |
listeners
the observers of this collection |
| Constructor Summary | |
|---|---|
ObservableSet()
Constructs a new, empty set; the backing HashMap instance has default initial capacity (16) and load factor (0.75). |
|
ObservableSet(java.util.Collection c)
Constructs a new set containing the elements in the specified collection. |
|
ObservableSet(int initialCapacity)
Constructs a new, empty set; the backing HashMap instance has the specified initial capacity and default load factor, which is 0.75. |
|
ObservableSet(int initialCapacity,
float loadFactor)
Constructs a new, empty set; the backing HashMap instance has the specified initial capacity and the specified load factor. |
|
| Method Summary | |
|---|---|
boolean |
add(java.lang.Object o)
Calls the super class's corresponding method and fires a CollectionEvent. |
boolean |
addAll(java.util.Collection c)
Calls the super class's corresponding method and fires a CollectionEvent. |
void |
addCollectionListener(CollectionListener l)
Adds a listener to this collection. |
void |
clear()
Calls the super class's corresponding method and fires a CollectionEvent. |
protected void |
fireCollectionEvent(CollectionEvent e)
Fires a CollectionEvent to all listeners. |
java.lang.Object |
getObservedCollection()
To access the collection that is being observed. |
boolean |
remove(java.lang.Object o)
Calls the super class's corresponding method and fires a CollectionEvent. |
boolean |
removeAll(java.util.Collection c)
Calls the super class's corresponding method and fires a CollectionEvent. |
void |
removeCollectionListener(CollectionListener l)
Removes the listener from this collection. |
boolean |
retainAll(java.util.Collection c)
Calls the super class's corresponding method and fires a CollectionEvent. |
| Methods inherited from class java.util.HashSet |
|---|
clone, contains, isEmpty, iterator, size |
| Methods inherited from class java.util.AbstractSet |
|---|
equals, hashCode |
| Methods inherited from class java.util.AbstractCollection |
|---|
containsAll, toArray, toArray, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Set |
|---|
containsAll, equals, hashCode, toArray, toArray |
| Field Detail |
|---|
protected java.util.ArrayList listeners
| Constructor Detail |
|---|
public ObservableSet()
public ObservableSet(java.util.Collection c)
c - the collection whose elements are to be placed into this set.
public ObservableSet(int initialCapacity,
float loadFactor)
initialCapacity - the initial capacity of the hash map.loadFactor - the load factor of the hash map.public ObservableSet(int initialCapacity)
initialCapacity - the initial capacity of the hash table.| Method Detail |
|---|
public boolean add(java.lang.Object o)
add in interface java.util.Collectionadd in interface java.util.Setadd in class java.util.HashSetpublic boolean remove(java.lang.Object o)
remove in interface java.util.Collectionremove in interface java.util.Setremove in class java.util.HashSetpublic boolean addAll(java.util.Collection c)
addAll in interface java.util.CollectionaddAll in interface java.util.SetaddAll in class java.util.AbstractCollectionpublic boolean removeAll(java.util.Collection c)
removeAll in interface java.util.CollectionremoveAll in interface java.util.SetremoveAll in class java.util.AbstractSetpublic void clear()
clear in interface java.util.Collectionclear in interface java.util.Setclear in class java.util.HashSetpublic boolean retainAll(java.util.Collection c)
retainAll in interface java.util.CollectionretainAll in interface java.util.SetretainAll in class java.util.AbstractCollectionpublic void addCollectionListener(CollectionListener l)
addCollectionListener in interface ObservableCollectionl - the CollectionListenerpublic void removeCollectionListener(CollectionListener l)
removeCollectionListener in interface ObservableCollectionl - the CollectionListenerprotected void fireCollectionEvent(CollectionEvent e)
e - the CollectionEventpublic java.lang.Object getObservedCollection()
getObservedCollection in interface ObservableCollection
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||