Top Description Inners Fields Constructors Methods
com.sun.javafx.collections

public Class ObservableSetWrapper<E>

extends Object
implements ObservableSet<E>
Class Inheritance
All Implemented Interfaces
javafx.collections.ObservableSet, javafx.beans.Observable, java.util.Set, java.util.Collection, java.lang.Iterable
Imports
javafx.beans.InvalidationListener, javafx.collections.ObservableSet, .SetChangeListener, java.util.Collection, .Iterator, .Set

A Set wrapper class that implements observability.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
private class

Field Summary

Modifier and TypeField and Description
private final Set<E>
private SetListenerHelper<E>

Constructor Summary

AccessConstructor and Description
public
ObservableSetWrapper(Set<E>
the set being wrapped
set
)

Creates new instance of ObservableSet that wraps the particular set specified by the parameter set.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the element was added
add
(E
the element to be added to the set
o
)

Implements java.util.Set.add.

Adds the specific element into this set and call all the registered observers unless the set already contains the element.

public boolean

Returns:

true if this set changed as a result of the call
addAll
(Collection<? extends E>
collection containing elements to be added to this set
c
)

Implements java.util.Set.addAll.

Adds the elements from the specified collection.

public void
addListener(InvalidationListener listener)

Implements javafx.beans.Observable.addListener.

Adds an InvalidationListener which will be notified whenever the Observable becomes invalid.

public void
addListener(SetChangeListener<? super E> observer)

Implements javafx.collections.ObservableSet.addListener.

Add a listener to this observable set.

private void
public void
clear()

Implements java.util.Set.clear.

Removes all the elements from this set.

public boolean

Returns:

true if this set contains specified element
contains
(Object
an element that is being looked for
o
)

Implements java.util.Set.contains.

Returns true if this set contains specified element.

public boolean

Returns:

true if the set contains all the elements in the specified collection
containsAll
(Collection<?>
collection to be checked for containment in this set
c
)

Implements java.util.Set.containsAll.

Test this set if it contains all the elements in the specified collection.

public boolean

Returns:

true if the wrapped is equal to the obj argument
equals
(Object
the reference object with which to compare
obj
)

Overrides java.lang.Object.equals.

Implements java.util.Set.equals.

Indicates whether some other object is "equal to" the wrapped set.

public int

Returns:

the hash code for the wrapped set
hashCode
()

Overrides java.lang.Object.hashCode.

Implements java.util.Set.hashCode.

Returns the hash code for the wrapped set.

public boolean

Returns:

true if this set contains no elements
isEmpty
()

Implements java.util.Set.isEmpty.

Returns true if this set contains no elements.

public Iterator<E>

Returns:

an iterator over the elements in this set
iterator
()

Implements java.util.Set.iterator.

Returns an iterator over the elements in this set.

public boolean

Returns:

true if the element was removed
remove
(Object
the element to be removed from the set
o
)

Implements java.util.Set.remove.

Removes the specific element from this set and call all the registered observers if the set contained the element.

public boolean

Returns:

true if this set changed as a result of the call
removeAll
(Collection<?>
collection containing elements to be removed from this set
c
)

Implements java.util.Set.removeAll.

Removes all the elements that are contained in the specified collection.

public void
removeListener(InvalidationListener listener)

Implements javafx.beans.Observable.removeListener.

Removes the given listener from the list of listeners, that are notified whenever the value of the Observable becomes invalid.

public void
removeListener(SetChangeListener<? super E> observer)

Implements javafx.collections.ObservableSet.removeListener.

Tries to removed a listener from this observable set.

private boolean
removeRetain(Collection<?> c, boolean remove)

public boolean

Returns:

true if this set changed as a result of the call
retainAll
(Collection<?>
collection containing elements to be kept in this set
c
)

Implements java.util.Set.retainAll.

Keeps only elements that are included in the specified collection.

public int

Returns:

number of elements contained in the set
size
()

Implements java.util.Set.size.

Returns number of elements contained in this set.

public Object[]

Returns:

an array containing all of the elements in this set
toArray
()

Implements java.util.Set.toArray.

Returns an array containing all of the elements in this set.

public <T> T[]

Returns:

an array containing all of the elements in this set
toArray
(T[]
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
a
)

Implements java.util.Set.toArray.

Returns an array containing all of the elements in this set.

public String

Returns:

the String representation of the wrapped set
toString
()

Overrides java.lang.Object.toString.

Returns the String representation of the wrapped set.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

backingSetback to summary
private final Set<E> backingSet
listenerHelperback to summary
private SetListenerHelper<E> listenerHelper

Constructor Detail

ObservableSetWrapperback to summary
public ObservableSetWrapper(Set<E> set)

Creates new instance of ObservableSet that wraps the particular set specified by the parameter set.

Parameters
set:Set<E>

the set being wrapped

Method Detail

addback to summary
public boolean add(E o)

Implements java.util.Set.add.

Adds the specific element into this set and call all the registered observers unless the set already contains the element. Returns true in the case the element was added to the set.

Parameters
o:E

the element to be added to the set

Returns:boolean

true if the element was added

Annotations
@Override
See Also
in JDK API documentation
addAllback to summary
public boolean addAll(Collection<? extends E> c)

Implements java.util.Set.addAll.

Adds the elements from the specified collection. Observers are called for each elements that was not already present in the set.

Parameters
c:Collection<? extends E>

collection containing elements to be added to this set

Returns:boolean

true if this set changed as a result of the call

Annotations
@Override
See Also
in JDK API documentation
addListenerback to summary
public void addListener(InvalidationListener listener)

Implements javafx.beans.Observable.addListener.

Doc from javafx.beans.Observable.addListener.

Adds an InvalidationListener which will be notified whenever the Observable becomes invalid. If the same listener is added more than once, then it will be notified more than once. That is, no check is made to ensure uniqueness.

Note that the same actual InvalidationListener instance may be safely registered for different Observables.

The Observable stores a strong reference to the listener which will prevent the listener from being garbage collected and may result in a memory leak. It is recommended to either unregister a listener by calling removeListener after use or to use an instance of WeakInvalidationListener avoid this situation.

Annotations
@Override
addListenerback to summary
public void addListener(SetChangeListener<? super E> observer)

Implements javafx.collections.ObservableSet.addListener.

Doc from javafx.collections.ObservableSet.addListener.

Add a listener to this observable set.

Annotations
@Override
callObserversback to summary
private void callObservers(SetChangeListener.Change<E> change)
clearback to summary
public void clear()

Implements java.util.Set.clear.

Removes all the elements from this set. Observers are called for each element.

Annotations
@Override
See Also
in JDK API documentation
containsback to summary
public boolean contains(Object o)

Implements java.util.Set.contains.

Returns true if this set contains specified element.

Parameters
o:Object

an element that is being looked for

Returns:boolean

true if this set contains specified element

Annotations
@Override
See Also
in JDK API documentation
containsAllback to summary
public boolean containsAll(Collection<?> c)

Implements java.util.Set.containsAll.

Test this set if it contains all the elements in the specified collection. In such case returns true.

Parameters
c:Collection<?>

collection to be checked for containment in this set

Returns:boolean

true if the set contains all the elements in the specified collection

Annotations
@Override
See Also
in JDK API documentation
equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Implements java.util.Set.equals.

Indicates whether some other object is "equal to" the wrapped set.

Parameters
obj:Object

the reference object with which to compare

Returns:boolean

true if the wrapped is equal to the obj argument

Annotations
@Override
See Also
in JDK API documentation
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Implements java.util.Set.hashCode.

Returns the hash code for the wrapped set.

Returns:int

the hash code for the wrapped set

Annotations
@Override
See Also
in JDK API documentation
isEmptyback to summary
public boolean isEmpty()

Implements java.util.Set.isEmpty.

Returns true if this set contains no elements.

Returns:boolean

true if this set contains no elements

Annotations
@Override
See Also
in JDK API documentation
iteratorback to summary
public Iterator<E> iterator()

Implements java.util.Set.iterator.

Returns an iterator over the elements in this set. If the iterator's remove() method is called then the registered observers are called as well.

Returns:Iterator<E>

an iterator over the elements in this set

Annotations
@Override
See Also
in JDK API documentation
removeback to summary
public boolean remove(Object o)

Implements java.util.Set.remove.

Removes the specific element from this set and call all the registered observers if the set contained the element. Returns true in the case the element was removed from the set.

Parameters
o:Object

the element to be removed from the set

Returns:boolean

true if the element was removed

Annotations
@Override
See Also
in JDK API documentation
removeAllback to summary
public boolean removeAll(Collection<?> c)

Implements java.util.Set.removeAll.

Removes all the elements that are contained in the specified collection. Observers are called for each removed element.

Parameters
c:Collection<?>

collection containing elements to be removed from this set

Returns:boolean

true if this set changed as a result of the call

Annotations
@Override
See Also
in JDK API documentation
removeListenerback to summary
public void removeListener(InvalidationListener listener)

Implements javafx.beans.Observable.removeListener.

Doc from javafx.beans.Observable.removeListener.

Removes the given listener from the list of listeners, that are notified whenever the value of the Observable becomes invalid.

If the given listener has not been previously registered (i.e. it was never added) then this method call is a no-op. If it had been previously added then it will be removed. If it had been added more than once, then only the first occurrence will be removed.

Annotations
@Override
removeListenerback to summary
public void removeListener(SetChangeListener<? super E> observer)

Implements javafx.collections.ObservableSet.removeListener.

Doc from javafx.collections.ObservableSet.removeListener.

Tries to removed a listener from this observable set. If the listener is not attached to this list, nothing happens.

Annotations
@Override
removeRetainback to summary
private boolean removeRetain(Collection<?> c, boolean remove)
retainAllback to summary
public boolean retainAll(Collection<?> c)

Implements java.util.Set.retainAll.

Keeps only elements that are included in the specified collection. All other elements are removed. For each removed element all the observers are called.

Parameters
c:Collection<?>

collection containing elements to be kept in this set

Returns:boolean

true if this set changed as a result of the call

Annotations
@Override
See Also
java.util.Set
sizeback to summary
public int size()

Implements java.util.Set.size.

Returns number of elements contained in this set.

Returns:int

number of elements contained in the set

Annotations
@Override
See Also
in JDK API documentation
toArrayback to summary
public Object[] toArray()

Implements java.util.Set.toArray.

Returns an array containing all of the elements in this set.

Returns:Object[]

an array containing all of the elements in this set

Annotations
@Override
See Also
in JDK API documentation
toArrayback to summary
public <T> T[] toArray(T[] a)

Implements java.util.Set.toArray.

Returns an array containing all of the elements in this set. The runtime type of the returned array is that of the specified array.

Parameters
a:T[]

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

Returns:T[]

an array containing all of the elements in this set

Annotations
@Override
See Also
in JDK API documentation
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns the String representation of the wrapped set.

Returns:String

the String representation of the wrapped set

Annotations
@Override
See Also
in JDK API documentation
com.sun.javafx.collections back to summary

private Class ObservableSetWrapper.SimpleAddChange

extends SetChangeListener.Change<E>
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final E

Constructor Summary

AccessConstructor and Description
public
SimpleAddChange(E added)

Method Summary

Modifier and TypeMethod and Description
public E
public E
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public boolean
wasAdded()

Implements abstract javafx.collections.SetChangeListener.Change.wasAdded.

If this change is a result of add operation.

public boolean
wasRemoved()

Implements abstract javafx.collections.SetChangeListener.Change.wasRemoved.

If this change is a result of removal operation.

Inherited from javafx.collections.SetChangeListener.Change:
getSet

Field Detail

addedback to summary
private final E added

Constructor Detail

SimpleAddChangeback to summary
public SimpleAddChange(E added)

Method Detail

getElementAddedback to summary
public E getElementAdded()

Implements abstract javafx.collections.SetChangeListener.Change.getElementAdded.

Doc from javafx.collections.SetChangeListener.Change.getElementAdded.

Get the new element. Return null if this is a removal.

Annotations
@Override
getElementRemovedback to summary
public E getElementRemoved()

Implements abstract javafx.collections.SetChangeListener.Change.getElementRemoved.

Doc from javafx.collections.SetChangeListener.Change.getElementRemoved.

Get the old element. Return null if this is an addition.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
wasAddedback to summary
public boolean wasAdded()

Implements abstract javafx.collections.SetChangeListener.Change.wasAdded.

Doc from javafx.collections.SetChangeListener.Change.wasAdded.

If this change is a result of add operation.

Annotations
@Override
wasRemovedback to summary
public boolean wasRemoved()

Implements abstract javafx.collections.SetChangeListener.Change.wasRemoved.

Doc from javafx.collections.SetChangeListener.Change.wasRemoved.

If this change is a result of removal operation.

Annotations
@Override
com.sun.javafx.collections back to summary

private Class ObservableSetWrapper.SimpleRemoveChange

extends SetChangeListener.Change<E>
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final E

Constructor Summary

AccessConstructor and Description
public
SimpleRemoveChange(E removed)

Method Summary

Modifier and TypeMethod and Description
public E
public E
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public boolean
wasAdded()

Implements abstract javafx.collections.SetChangeListener.Change.wasAdded.

If this change is a result of add operation.

public boolean
wasRemoved()

Implements abstract javafx.collections.SetChangeListener.Change.wasRemoved.

If this change is a result of removal operation.

Inherited from javafx.collections.SetChangeListener.Change:
getSet

Field Detail

removedback to summary
private final E removed

Constructor Detail

SimpleRemoveChangeback to summary
public SimpleRemoveChange(E removed)

Method Detail

getElementAddedback to summary
public E getElementAdded()

Implements abstract javafx.collections.SetChangeListener.Change.getElementAdded.

Doc from javafx.collections.SetChangeListener.Change.getElementAdded.

Get the new element. Return null if this is a removal.

Annotations
@Override
getElementRemovedback to summary
public E getElementRemoved()

Implements abstract javafx.collections.SetChangeListener.Change.getElementRemoved.

Doc from javafx.collections.SetChangeListener.Change.getElementRemoved.

Get the old element. Return null if this is an addition.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
wasAddedback to summary
public boolean wasAdded()

Implements abstract javafx.collections.SetChangeListener.Change.wasAdded.

Doc from javafx.collections.SetChangeListener.Change.wasAdded.

If this change is a result of add operation.

Annotations
@Override
wasRemovedback to summary
public boolean wasRemoved()

Implements abstract javafx.collections.SetChangeListener.Change.wasRemoved.

Doc from javafx.collections.SetChangeListener.Change.wasRemoved.

If this change is a result of removal operation.

Annotations
@Override