public abstract class Behavior extends java.lang.Object implements IBehavior, java.io.Serializable
Constructor and Description |
---|
Behavior(Behavior source)
Copy constructor
|
Behavior(java.lang.String name,
IThoughtModel thoughtModel)
Default constructor for Behaviors
|
Modifier and Type | Method and Description |
---|---|
void |
abort()
Called when to stop this behavior without caring for stopping it softly
|
int |
getConsecutivePerforms() |
float |
getIntensity() |
java.lang.String |
getName()
Retrieve the behavior name
|
int |
getPerforms()
Retrieve the number of times this behavior has been performed/initialized
|
IBehavior |
getRootBehavior()
A call does not have side effects.
|
int |
getSuccessfulPerforms()
This method will only return sensible values for those behaviors that have
implemented a corresponding estimation what successful means.
|
int |
getUnsuccessfulPerforms()
This method will only return sensible values for those behaviors that have
implemented a corresponding estimation what successful means.
|
void |
init()
Reinitializes the Behavior-StateMachine (if present)
|
boolean |
isFinished()
Check if this behavior is finished performing
|
void |
onLeavingBehavior(IBehavior newBehavior)
Called to notify this behavior that is no longer performed and replaced by
the new behavior.
|
void |
reload()
Reloads this behaviors.
|
void |
setIntensity(float intensity) |
void |
setName(java.lang.String name)
Set behavior name
|
void |
stayIn()
Called if we decided again for that behavior
|
IBehavior |
switchFrom(IBehavior actualBehavior)
Decide if it is possible to switch to this behavior from the current
behavior.
|
java.lang.String |
toString() |
public Behavior(java.lang.String name, IThoughtModel thoughtModel)
name
- Behavior nameworldModel
- World modelagentModel
- Agent modelcoordinator
- Coordinatorpublic Behavior(Behavior source)
source
- Source object to copy instance variables frompublic int getPerforms()
IBehavior
getPerforms
in interface IBehavior
public int getConsecutivePerforms()
getConsecutivePerforms
in interface IBehavior
public int getSuccessfulPerforms()
IBehavior
getSuccessfulPerforms
in interface IBehavior
public int getUnsuccessfulPerforms()
IBehavior
getUnsuccessfulPerforms
in interface IBehavior
public final java.lang.String getName()
IBehavior
public void init()
IBehavior
public boolean isFinished()
IBehavior
isFinished
in interface IBehavior
public void setName(java.lang.String name)
name
- New namepublic void abort()
IBehavior
public IBehavior switchFrom(IBehavior actualBehavior)
IBehavior
switchFrom
in interface IBehavior
actualBehavior
- the currently/actually performed behaviorpublic void stayIn()
IBehavior
public void onLeavingBehavior(IBehavior newBehavior)
IBehavior
onLeavingBehavior
in interface IBehavior
newBehavior
- the new behavior which will be performed after this
behaviorpublic IBehavior getRootBehavior()
IBehavior
getRootBehavior
in interface IBehavior
public java.lang.String toString()
toString
in class java.lang.Object
public float getIntensity()
getIntensity
in interface IBehavior
public void setIntensity(float intensity)
setIntensity
in interface IBehavior
intensity
- the intensity with which to perform the behavior. Values
are free to use, but are typically in the range of [0..1]