|
||||||||||
| 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 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(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(Object o)
Calls the super class's corresponding method and fires a CollectionEvent. |
boolean |
addAll(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. |
Object |
getObservedCollection()
To access the collection that is being observed. |
boolean |
remove(Object o)
Calls the super class's corresponding method and fires a CollectionEvent. |
boolean |
removeAll(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(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 ArrayList listeners
| Constructor Detail |
|---|
public ObservableSet()
public ObservableSet(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(Object o)
add in interface Collectionadd in interface Setadd in class HashSetpublic boolean remove(Object o)
remove in interface Collectionremove in interface Setremove in class HashSetpublic boolean addAll(Collection c)
addAll in interface CollectionaddAll in interface SetaddAll in class AbstractCollectionpublic boolean removeAll(Collection c)
removeAll in interface CollectionremoveAll in interface SetremoveAll in class AbstractSetpublic void clear()
clear in interface Collectionclear in interface Setclear in class HashSetpublic boolean retainAll(Collection c)
retainAll in interface CollectionretainAll in interface SetretainAll in class 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 Object getObservedCollection()
getObservedCollection in interface ObservableCollection
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||