|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.wpi.ebob.model.ObjectBench
public class ObjectBench
Nested Class Summary | |
---|---|
private class |
ObjectBench.Obj
|
Field Summary | |
---|---|
private org.eclipse.jface.util.ListenerList |
listeners
|
private java.util.HashMap |
objs
contains the actual mappings for name/object pairs. |
Constructor Summary | |
---|---|
ObjectBench()
|
Method Summary | |
---|---|
void |
addDependency(java.lang.String name,
java.lang.String dependent)
Creates a dependency between two objects in the object bench. |
void |
addObject(java.lang.String name,
IObject obj)
adds object obj with the given name name . |
void |
addObjectBenchListener(ObjectBenchListener listener)
Adds the listener to receive events and immediately sends an event for each currently existing object in the bench. |
void |
addObjectBenchListener(ObjectBenchListener listener,
boolean sendCurrentObjects)
Adds the listener to receive events. |
boolean |
containsObject(java.lang.String name)
Returns true if the object with the given name exists in
the bench, false otherwise. |
private void |
fireObjectAddedEvent(ObjectBenchEvent event)
alerts all listeners that an object has been added. |
private void |
fireObjectRemovedEvent(ObjectBenchEvent event)
alerts all listeners that an object has been removed. |
java.lang.String[] |
getDependents(java.lang.String name)
Retrieves the objects that are dependent on this name . |
java.lang.String[] |
getNames()
Returns an array of the names of the objects associated with this bench. |
IObject |
getObject(java.lang.String name)
returns a handle to the object in the bench specified by name name . |
boolean |
hasDependents(java.lang.String name)
|
void |
removeAll()
Clears the Object Bench, removing all objects from the bench. |
boolean |
removeObject(java.lang.String name)
removes an object with the specified name from the Object Bench. |
void |
removeObjectBenchListener(ObjectBenchListener listener)
Removes the specified object bench listener so that it no longer receives events from the Object Bench. |
boolean |
removeObjectCascade(java.lang.String name)
Removes the object from the object bench. |
boolean |
removeObjectForced(java.lang.String name)
Removes the object name from the Object Bench. |
boolean |
removeObjects(IClass c)
Removes all objects of the specified class. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private org.eclipse.jface.util.ListenerList listeners
private java.util.HashMap objs
Constructor Detail |
---|
public ObjectBench()
Method Detail |
---|
public void addObject(java.lang.String name, IObject obj) throws ObjectAdditionNotSupportedException
obj
with the given name name
.
name
- the name of the object within the Object Bench.obj
- the actual object in the bench.
ObjectAdditionNotSupportedException
- if there is an object already with the given name, or if
there was an exception thrown when adding the object to the
view.public void addObjectBenchListener(ObjectBenchListener listener)
listener
- the listenerObjectBenchListener
public void addObjectBenchListener(ObjectBenchListener listener, boolean sendCurrentObjects)
sendCurrentObjects
is true
, the listener is immediately send an event for
every object currently existing in the Object Bench.
listener
- sendCurrentObjects
- public void addDependency(java.lang.String name, java.lang.String dependent)
name
- the name of the independent object.dependent
- the name of the object that is dependent on name
.public java.lang.String[] getDependents(java.lang.String name)
name
.
name
- the name of the independent object.
public boolean hasDependents(java.lang.String name)
true
if there exists at least one object that is
dependent on an object named name
,
false
otherwise.public boolean containsObject(java.lang.String name)
true
if the object with the given name exists in
the bench, false
otherwise.
name
- the name of the object to check for.private void fireObjectAddedEvent(ObjectBenchEvent event)
event
- the event that listeners should be alerted to.private void fireObjectRemovedEvent(ObjectBenchEvent event)
event
- the event that listeners should be alerted to.public java.lang.String[] getNames()
public IObject getObject(java.lang.String name)
name
.
name
- the name of the object to retrieve.public boolean removeObject(java.lang.String name) throws ObjectRemovalNotSupportedException
name
- the name of the object to remove.
true
if the object was able to be removed,
false
otherwise.
ObjectRemovalNotSupportedException
- if there is an object dependency obstructing the removal of
the object, or if there was any exception thrown while trying
to remove the object to the view.public boolean removeObjectCascade(java.lang.String name)
name
- the name of the object to remove.
true
if the object was able to be removed,
false
otherwise.public boolean removeObjectForced(java.lang.String name)
name
from the Object Bench. Dependents
are not removed.
name
- the name of the object to remove.
true
if the object was able to be removed,
false
otherwise.public void removeObjectBenchListener(ObjectBenchListener listener)
listener
- the listenerpublic boolean removeObjects(IClass c) throws ObjectRemovalNotSupportedException
c
- the class of objects which you want to remove.
true
if all objects of this class were
able to be removed, false
otherwise.
ObjectRemovalNotSupportedException
- if there is an object dependency obstructing the removal of
an object, or if there was any exception thrown while trying
to add an object to the view. If there was an exception
thrown, it can be retrieved by Throwable.getCause()
,
however it is not guaranteed that all objects specified could
not be added for that reason.public void removeAll()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |