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.


Constructor Index

 o Cell()

Method Index

 o enumerateDelegateNames()
Returns an enumeration of all the delegate names in no particular order.
 o getDeferredServiceSource()
Returns the ServiceSource for deferred needs.
 o getDelegate(String)
Returns the named delegate or null if none.
 o getPartNamesNeeded()
Returns an array of the part names this part needs to do its work.
 o replicate()
Returns a copy of itself without mission state.
 o satisfyNeed(ServiceNeed, boolean)
Finds and returns the service to satisfy the need.
 o setDelegate(String, Object)
Not allowed since a Cell provides its own delegates.
 o setPart(String, Object)
Sets a named part, in response to part needs.

Constructors

 o Cell
 public Cell()

Methods

 o 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.
 o 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.
 o replicate
 public Object replicate()
Returns a copy of itself without mission state.

Returns:
the replication.
 o 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.
 o 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.
 o enumerateDelegateNames
 public Enumeration enumerateDelegateNames()
Returns an enumeration of all the delegate names in no particular order.

Returns:
an enumeration of the delegate names.
 o getDeferredServiceSource
 public ServiceSource getDeferredServiceSource()
Returns the ServiceSource for deferred needs.

Returns:
the source to use in satisfying deferred needs.
 o 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