|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--fcmodeler.util.ObservableSet
A set that notifies listeners of any modications. Other classes can implement the
SetChangeListener
interface, and register with this class to receive notifiactions
of any changes to the wrapped set. Note that listeners are notified after the set has already been
modified.
Constructor Summary | |
ObservableSet()
Creates a new ObservableSet using a java.util.HashSet . |
|
ObservableSet(java.util.Set set)
Creates a new ObservableSet that wraps the specified set. |
Method Summary | |
boolean |
add(java.lang.Object obj)
Adds the specified element to this set if it is not already present and notifies listeners of the addition. |
boolean |
addAll(java.util.Collection collection)
Adds all of the elements in the specified collection to this set if they're not already present and notifies listeners of any elements that are added. |
void |
addSetChangeListener(SetChangeListener listener)
Registers the specified listener with this set. |
void |
clear()
Removes all of the elements from this set and notifies listeners of the removals. |
boolean |
contains(java.lang.Object obj)
Returns true if this set contains the specified element. |
boolean |
containsAll(java.util.Collection collection)
Returns true if this set contains all of the elements of the specified collection. |
boolean |
equals(java.lang.Object obj)
Compares the specified object with this set for equality. |
protected void |
fireElementAdded(java.lang.Object element)
Notifies listeners that the specified element has been added to this set. |
protected void |
fireElementRemoved(java.lang.Object element)
Notifies listeners that the specified element has been removed from this set. |
java.util.Set |
getSet()
Returns the set that this set wraps. |
java.util.Iterator |
getSetChangeListeners()
Returns an iterator over all listeners for this set. |
int |
hashCode()
Returns the hash code value for this set. |
boolean |
isEmpty()
Returns true if this set contains no elements. |
java.util.Iterator |
iterator()
Returns an iterator over the elements in this set |
boolean |
remove(java.lang.Object obj)
Removes the specified element from this set if it is present and notifies listeners of the removal. |
boolean |
removeAll(java.util.Collection collection)
Removes from this set all of its elements that are contained in the specified collection and notifies listeners of the removals. |
void |
removeSetChangeListener(SetChangeListener listener)
Stops the specified listener from receiving notifications from this set. |
boolean |
retainAll(java.util.Collection collection)
Retains only the elements in this set that are contained in the specified collection and notifies listeners of the removals. |
int |
size()
Returns the number of elements in this set. |
java.lang.Object[] |
toArray()
Returns an array containing all of the elements in this set. |
java.lang.Object[] |
toArray(java.lang.Object[] obj)
Returns an array containing all of the elements in this set whose runtime type is that of the specified array. |
java.lang.String |
toString()
Returns a string representation of this set. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ObservableSet()
ObservableSet
using a java.util.HashSet
.public ObservableSet(java.util.Set set)
ObservableSet
that wraps the specified set.set
- the set to notify listeners of changes to.Method Detail |
public boolean add(java.lang.Object obj)
add
in interface java.util.Set
obj
- the element to add.true
if the element was added.public boolean addAll(java.util.Collection collection)
addAll
in interface java.util.Set
collection
- the collection whose elements are to be added to this set.true
if any of the elements were added.public void addSetChangeListener(SetChangeListener listener)
listener
- the listener to register with this set.public void clear()
clear
in interface java.util.Set
public boolean contains(java.lang.Object obj)
true
if this set contains the specified element.contains
in interface java.util.Set
obj
- element to test for containment.true
if this set contains the specified element.public boolean containsAll(java.util.Collection collection)
true
if this set contains all of the elements of the specified collection.containsAll
in interface java.util.Set
collection
- the collection to test for containment.true
if this set contains all of the elements of the specified collection.public boolean equals(java.lang.Object obj)
equals
in interface java.util.Set
equals
in class java.lang.Object
obj
- the object to test for equality.true
if the specified object is equal to this set.protected void fireElementAdded(java.lang.Object element)
element
- the element added to this set.protected void fireElementRemoved(java.lang.Object element)
element
- the element that was removed.public java.util.Set getSet()
public java.util.Iterator getSetChangeListeners()
public int hashCode()
hashCode
in interface java.util.Set
hashCode
in class java.lang.Object
public boolean isEmpty()
isEmpty
in interface java.util.Set
true
if this set contains no elements.public java.util.Iterator iterator()
iterator
in interface java.util.Set
public boolean remove(java.lang.Object obj)
remove
in interface java.util.Set
obj
- the element to remove from this set.true
if the element was removed.public boolean removeAll(java.util.Collection collection)
removeAll
in interface java.util.Set
collection
- the collection whose elements are to be removed from this set.true
if any of the collection's elements were removed.public void removeSetChangeListener(SetChangeListener listener)
listener
- the listener to stop receiving notifications from this set.public boolean retainAll(java.util.Collection collection)
retainAll
in interface java.util.Set
collection
- collection that defines which elements this set will retain.true
if any elements were removed from this set.public int size()
size
in interface java.util.Set
public java.lang.Object[] toArray()
toArray
in interface java.util.Set
public java.lang.Object[] toArray(java.lang.Object[] obj)
toArray
in interface java.util.Set
obj
- the array into which the elements of this set are to be stored, if it is big enough;
otherwise, a new array of the same runtime type is allocated for this purpose.public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |