public class GeneralObjectManager<O extends ISimulationObject,L extends IObjectListener<O>> extends java.lang.Object implements IMutableObjectManager<O,L>
Constructor and Description |
---|
GeneralObjectManager() |
Modifier and Type | Method and Description |
---|---|
boolean |
add(java.util.Collection<O> objects)
add all of the objects to the manager and fire an appropriate event
|
boolean |
add(O object)
add this single object and fire an event
|
void |
addListener(L listener,
java.util.concurrent.Executor executor)
add a listener that will have its objectAdded,removed,updated methods fired
appropriately on the provided executor
|
boolean |
contains(IIdentifier identifier)
does this object manager have an object O that is keyed on this identifier
|
protected void |
fire(IObjectEvent.Type type,
java.util.Collection<O> objects)
fire an event either added or removed
|
protected void |
fireUpdate(java.util.Collection<? extends IObjectDelta> deltas)
fire an update event
|
O |
get(IIdentifier identifier)
return the object O that is keyed on identifier
|
java.util.Collection<IIdentifier> |
getIdentifiers()
return all the identifiers that have matched objects
|
java.util.Collection<L> |
getListeners()
return a collection containing all the installed listeners
|
boolean |
hasListeners()
are there any registered listeners?
|
boolean |
remove(java.util.Collection<IIdentifier> identifiers)
remove all the objects that are keyed on identifier.
|
boolean |
remove(IIdentifier id)
remove the object that is keyed on id and fire an event
|
void |
removeListener(L listener)
remove said listener
|
boolean |
update(java.util.Collection<IObjectDelta> deltas)
update all these obejcts
|
boolean |
update(IObjectDelta delta)
update the object that is described by this delta with this delta.
|
void |
waitForChange()
wait until something has been added, removed, updated
|
public void addListener(L listener, java.util.concurrent.Executor executor)
addListener
in interface IObjectManager<O extends ISimulationObject,L extends IObjectListener<O>>
listener
- executor
- public void removeListener(L listener)
removeListener
in interface IObjectManager<O extends ISimulationObject,L extends IObjectListener<O>>
listener
- public boolean hasListeners()
hasListeners
in interface IObjectManager<O extends ISimulationObject,L extends IObjectListener<O>>
public java.util.Collection<L> getListeners()
getListeners
in interface IObjectManager<O extends ISimulationObject,L extends IObjectListener<O>>
public boolean update(IObjectDelta delta)
update
in interface IMutableObjectManager<O extends ISimulationObject,L extends IObjectListener<O>>
delta
- public boolean update(java.util.Collection<IObjectDelta> deltas)
update
in interface IMutableObjectManager<O extends ISimulationObject,L extends IObjectListener<O>>
deltas
- public boolean add(O object)
add
in interface IMutableObjectManager<O extends ISimulationObject,L extends IObjectListener<O>>
object
- public boolean add(java.util.Collection<O> objects)
add
in interface IMutableObjectManager<O extends ISimulationObject,L extends IObjectListener<O>>
objects
- protected final void fire(IObjectEvent.Type type, java.util.Collection<O> objects)
type
- objects
- protected final void fireUpdate(java.util.Collection<? extends IObjectDelta> deltas)
deltas
- public boolean remove(IIdentifier id)
remove
in interface IMutableObjectManager<O extends ISimulationObject,L extends IObjectListener<O>>
id
- public boolean remove(java.util.Collection<IIdentifier> identifiers)
remove
in interface IMutableObjectManager<O extends ISimulationObject,L extends IObjectListener<O>>
identifiers
- public O get(IIdentifier identifier)
get
in interface IObjectManager<O extends ISimulationObject,L extends IObjectListener<O>>
identifier
- public java.util.Collection<IIdentifier> getIdentifiers()
getIdentifiers
in interface IObjectManager<O extends ISimulationObject,L extends IObjectListener<O>>
public boolean contains(IIdentifier identifier)
identifier
- public void waitForChange() throws java.lang.InterruptedException
IObjectManager
waitForChange
in interface IObjectManager<O extends ISimulationObject,L extends IObjectListener<O>>
java.lang.InterruptedException