All Packages Class Hierarchy This Package Previous Next Index
Class uhr.core.cell.Cell
java.lang.Object
|
+----uhr.core.cell.Cell
- public class Cell
- extends Object
- implements PartUser, Replicatable,
Delegator, ServiceSourceDeferred,
ServiceSource
This class manages a System Tree container of parts. We use
the term "Cell" to allude to the biological metaphors involved
in the operation of this class. For example it can grow by
adding children, replicates itself to create new sub cells, and
sends and receives messages like a central nervous system
transmits nerve impulses.
A cell has so much to do it delegates all its work.
-
Cell()
-
-
enumerateDelegateNames()
- Returns an enumeration of all the delegate names in no
particular order.
-
getDeferredServiceSource()
- Returns the ServiceSource for deferred needs.
-
getDelegate(String)
- Returns the named delegate or null if none.
-
getPartNamesNeeded()
- Returns an array of the part names this part needs to
do its work.
-
replicate()
- Returns a copy of itself without mission state.
-
satisfyNeed(ServiceNeed,
boolean)
- Finds and returns the service to satisfy the need.
-
setDelegate(String,
Object)
- Not allowed since a Cell provides its own delegates.
-
setPart(String,
Object)
- Sets a named part, in response to part needs.
Cell
public Cell()
getPartNamesNeeded
public String[] getPartNamesNeeded()
- Returns an array of the part names this part needs to
do its work. These are "core.CellDK", "core.MessageRouter",
"core.Lifecycle", "core.Matchmaker". These are my delegates.
- Returns:
- the names of the parts needed.
setPart
public void setPart(String name,
Object part)
- Sets a named part, in response to part needs. This implementation
supports needed part replacement anytime. See the PartUser
interface for further documentation.
- Parameters:
- name - the name of the needed part.
- part - the needed part.
replicate
public Object replicate()
- Returns a copy of itself without mission state.
- Returns:
- the replication.
getDelegate
public Object getDelegate(String delegateName)
- Returns the named delegate or null if none. Our delegates are
"ParamDriven", "MessageSender", "MessageReceiver" and
"StateCommandable".
- Parameters:
- delegateName - the name of the desired delegate.
- Returns:
- the named delegate or null if none.
setDelegate
public void setDelegate(String delegateName,
Object delegate)
- Not allowed since a Cell provides its own delegates. The
exception is always thrown.
- Parameters:
- delegateName - the name of the delegate, which must be
unique within the Delegator.
- delegate - the delegate instance.
- Throws: IllegalStateException
- if the delegate is not settable.
enumerateDelegateNames
public Enumeration enumerateDelegateNames()
- Returns an enumeration of all the delegate names in no
particular order.
- Returns:
- an enumeration of the delegate names.
getDeferredServiceSource
public ServiceSource getDeferredServiceSource()
- Returns the ServiceSource for deferred needs.
- Returns:
- the source to use in satisfying deferred needs.
satisfyNeed
public Object satisfyNeed(ServiceNeed need,
boolean isNeededNow)
- Finds and returns the service to satisfy the need.
- Parameters:
- need - describes the service needed.
- isNeededNow - true to ignore
ServiceNeed.isDeferred()
or false to honor ServiceNeed.isDeferred().
- Returns:
- the best available service or null if none available.
Also returns null if isNeededNow is false and the need
if deferred, which is nonsense call anyhow.
All Packages Class Hierarchy This Package Previous Next Index