com.virtuosotechnologies.lib.container
Interface ObjectSet

All Superinterfaces:
ObjectContainer
All Known Subinterfaces:
ModifiableObjectSet, RequestableObjectSet
All Known Implementing Classes:
BasicModifiableObjectSet, PseudoModifiableObjectSet

public interface ObjectSet
extends ObjectContainer

A scaled-down set interface with listeners. This is basically a java.util.Set with several additional features: constraints on values, and listeners on state changes. Many applications will use the ModifiableObjectSet subinterface, which adds mutation methods.

This interface itself does not specify thread-safety semantics. The particular implementation or use in a larger interface should specify this. For example, standalone ObjectSets may be fully synchronized and thread-safe. ObjectSets related to AWT or Swing objects may require that all interaction be done on the AWT event thread.


Method Summary
 void addObjectSetListener(ObjectSetListener listener)
          Add an ObjectSetListener.
 boolean contains(Object obj)
          Ask whether an object is present in the set.
 void removeObjectSetListener(ObjectSetListener listener)
          Remove an ObjectSetListener.
 
Methods inherited from interface com.virtuosotechnologies.lib.container.ObjectContainer
getConstraints, getContentsAsArray, getSize
 

Method Detail

contains

public boolean contains(Object obj)
Ask whether an object is present in the set.

Parameters:
obj - object to test
Returns:
true if the set contains this object

addObjectSetListener

public void addObjectSetListener(ObjectSetListener listener)
Add an ObjectSetListener. Listeners should be added via weak references.

Parameters:
listener - new listener

removeObjectSetListener

public void removeObjectSetListener(ObjectSetListener listener)
Remove an ObjectSetListener. Does nothing if the listener is not already present.

Parameters:
listener - listener to remove