org.dyncle
Class ComponentBehaviour

java.lang.Object
  extended by jade.core.behaviours.Behaviour
      extended by jade.core.behaviours.SimpleBehaviour
          extended by org.dyncle.ComponentBehaviour
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ADTypeComponent, ATypeComponent, ChargeBattery, CTypeComponent, DiscoverObjectByRandomWalk, DiscoverObjectUsingCamera, Find, MoveTo, MoveTo, PickUpDust, SweepDust, UnloadDust

public abstract class ComponentBehaviour
extends jade.core.behaviours.SimpleBehaviour

A behavior corresponding to a component in design phase.

Version:
1.4: add "priority"
Author:
Hiroyuki NAKAGAWA
See Also:
Serialized Form

Field Summary
 Mode mode
           
 java.lang.String name
           
 int priority
           
 java.lang.String serviceType
           
 
Fields inherited from class jade.core.behaviours.Behaviour
STATE_BLOCKED, STATE_READY, STATE_RUNNING
 
Constructor Summary
ComponentBehaviour(SASystem a)
          This constructor sets the owner agent for this behavior.
ComponentBehaviour(SASystem a, java.lang.String name, java.lang.String serviceType)
          This constructor sets the component's name and service type.
 
Method Summary
 void action()
           
 void activate()
           
 void addPort(Port<?> port)
           
 void connectPorts(Port<?> p1, Port<?> p2)
          Connects two ports.
 void disconnectPorts(Port<?> p1, Port<?> p2)
          Disconnects ports.
 boolean done()
           
 java.lang.String getName()
           
 int getPriority()
          Return priority of this component.
 java.util.ArrayList<Port<?>> getProvidedPorts()
           
 java.util.ArrayList<Port<?>> getRequiredPorts()
           
 java.lang.String getServiceType()
           
 void passivate()
           
abstract  void perform()
           
 void setName(java.lang.String name)
           
 void setServiceType(java.lang.String serviceType)
           
 void terminate()
           
 
Methods inherited from class jade.core.behaviours.SimpleBehaviour
reset
 
Methods inherited from class jade.core.behaviours.Behaviour
actionWrapper, block, block, getBehaviourName, getDataStore, getExecutionState, getRestartCounter, handleRestartEvent, isRunnable, onEnd, onStart, restart, root, setAgent, setBehaviourName, setDataStore, setExecutionState
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mode

public Mode mode

name

public java.lang.String name

serviceType

public java.lang.String serviceType

priority

public int priority
Constructor Detail

ComponentBehaviour

public ComponentBehaviour(SASystem a)
This constructor sets the owner agent for this behavior.

Parameters:
a - The agent this behavior belongs to.

ComponentBehaviour

public ComponentBehaviour(SASystem a,
                          java.lang.String name,
                          java.lang.String serviceType)
This constructor sets the component's name and service type.

Parameters:
a - The agent this behavior belongs to.
name - component's name.
serviceType - components's service type.
Method Detail

action

public final void action()
Specified by:
action in class jade.core.behaviours.Behaviour

perform

public abstract void perform()

done

public boolean done()
Specified by:
done in class jade.core.behaviours.Behaviour

activate

public void activate()

passivate

public void passivate()

terminate

public void terminate()

getName

public java.lang.String getName()

setName

public void setName(java.lang.String name)

getServiceType

public java.lang.String getServiceType()

setServiceType

public void setServiceType(java.lang.String serviceType)

getPriority

public int getPriority()
Return priority of this component. This priority corresponds to that of the control loop.

Returns:

addPort

public void addPort(Port<?> port)

connectPorts

public void connectPorts(Port<?> p1,
                         Port<?> p2)
Connects two ports. If one provides exclusive service, it determines whether it should connect or not by comparing the priorities.

Parameters:
p1 - own port (required Port)
p2 - partner's port (provided Port)

disconnectPorts

public void disconnectPorts(Port<?> p1,
                            Port<?> p2)
Disconnects ports.

Parameters:
p1 - own port (required Port)
p2 - partner's port (provided Port)

getRequiredPorts

public java.util.ArrayList<Port<?>> getRequiredPorts()

getProvidedPorts

public java.util.ArrayList<Port<?>> getProvidedPorts()