public abstract class MusicalAgentComponent extends java.lang.Object implements LifeCycle, RouterClient
| Modifier and Type | Field and Description |
|---|---|
private MusicalAgent |
myAgent
The my agent.
|
private java.lang.String |
myName
The my name.
|
private Constants.EA_STATE |
myState
The my state.
|
private java.lang.String |
myType
The my type.
|
protected Parameters |
parameters
The parameters.
|
| Constructor and Description |
|---|
MusicalAgentComponent() |
| Modifier and Type | Method and Description |
|---|---|
void |
addParameter(java.lang.String key,
java.lang.String value)
Adds the parameter.
|
void |
addParameters(Parameters newParameters)
Adds the parameters.
|
boolean |
configure()
User-implemented method that configures the component, setting up user parameters and essential properties.
|
boolean |
finit()
User-implemented finalization method, called by stop().
|
java.lang.String |
getAddress()
Returns this component framework address.
|
MusicalAgent |
getAgent()
Gets the agent.
|
java.lang.String |
getComponentName()
Gets the component name.
|
java.lang.String |
getComponentType()
Gets the component type.
|
java.lang.String |
getParameter(java.lang.String key)
Gets the parameter.
|
java.lang.String |
getParameter(java.lang.String key,
java.lang.String defaultValue)
Gets the parameter.
|
Parameters |
getParameters()
Returns all configured parameters.
|
Constants.EA_STATE |
getState()
Gets the state.
|
java.lang.String |
getType()
Gets the type.
|
boolean |
init()
User-implemented initialization method, called by start().
|
boolean |
parameterUpdate(java.lang.String name,
java.lang.String newValue)
User-implement method called when a parameter has been updated.
|
void |
processCommand(Command cmd)
An user-implemented method to process a received command.
|
void |
receiveCommand(Command cmd)
A framework-implemented method that receives a command sent by the RouterAgent and calls processCommand.
|
void |
sendCommand(Command cmd)
A framework-implemented method that sends a command to its destination, via RouterAgent if the recipient is another agent.
|
protected void |
setAgent(MusicalAgent myAgent)
Sets the agent.
|
protected void |
setComponentName(java.lang.String myName)
Sets the component name.
|
void |
setParameters(Parameters parameters)
Framework-implemented method that sets system and user parameters.
|
protected void |
setState(Constants.EA_STATE myState)
Sets the state.
|
protected void |
setType(java.lang.String myType)
Sets the type.
|
private java.lang.String myName
private MusicalAgent myAgent
private java.lang.String myType
private Constants.EA_STATE myState
protected Parameters parameters
public final java.lang.String getComponentName()
public final java.lang.String getComponentType()
protected final void setComponentName(java.lang.String myName)
myName - the new component namepublic final MusicalAgent getAgent()
protected final void setAgent(MusicalAgent myAgent)
myAgent - the new agentpublic final java.lang.String getType()
protected final void setType(java.lang.String myType)
myType - the new typepublic final Constants.EA_STATE getState()
protected final void setState(Constants.EA_STATE myState)
myState - the new statepublic final void addParameter(java.lang.String key,
java.lang.String value)
key - the keyvalue - the valuepublic final void addParameters(Parameters newParameters)
newParameters - the new parameterspublic final java.lang.String getParameter(java.lang.String key)
key - the keypublic final java.lang.String getParameter(java.lang.String key,
java.lang.String defaultValue)
key - the keydefaultValue - the default valuepublic final void setParameters(Parameters parameters)
LifeCyclesetParameters in interface LifeCycleparameters - a Parameters object with all user and system Parameters for this objectpublic final Parameters getParameters()
LifeCyclegetParameters in interface LifeCyclepublic final java.lang.String getAddress()
RouterClientgetAddress in interface RouterClientpublic final void receiveCommand(Command cmd)
RouterClientreceiveCommand in interface RouterClientcmd - the cmdpublic final void sendCommand(Command cmd)
RouterClientsendCommand in interface RouterClientcmd - the cmdpublic boolean configure()
LifeCyclepublic boolean init()
LifeCyclepublic boolean finit()
LifeCyclepublic void processCommand(Command cmd)
RouterClientprocessCommand in interface RouterClientcmd - the cmdpublic boolean parameterUpdate(java.lang.String name,
java.lang.String newValue)
LifeCycleparameterUpdate in interface LifeCyclename - the namenewValue - the new value