|
RoboJDETM v2.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ridgesoft.robotics.behaviors.AbstractBehavior2
public abstract class AbstractBehavior2
Implements an abstract class providing the functionality of the Behavior2 inteface.
BehaviorArbiter
,
Behavior
,
Behavior2
,
BehaviorEvent
,
BehaviorListener
,
com.ridgesoft.robotics.behaviors
Field Summary | |
---|---|
protected boolean |
mEnabled
Current enabled state. |
protected boolean |
mIsActive
Current activation state. |
protected BehaviorListener |
mListener
Reference to the BehaviorListener or null if none is registered. |
Constructor Summary | |
---|---|
protected |
AbstractBehavior2(boolean enabled)
Initializes this class when a subclass is constructed. |
Method Summary | |
---|---|
abstract boolean |
poll()
This method is invoked at regular intervals to determine if the behavior desires to control the robot. |
void |
setActive(boolean isActive)
Activates or deactivates the behavior. |
void |
setEnabled(boolean enabled)
Enables or disables the behavior. |
void |
setListener(BehaviorListener listener)
Sets or clears the listener for the behavior. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait |
Field Detail |
---|
protected boolean mEnabled
protected boolean mIsActive
protected BehaviorListener mListener
Constructor Detail |
---|
protected AbstractBehavior2(boolean enabled)
enabled
- true if the behavior is to be initially enabled, otherwise falseMethod Detail |
---|
public abstract boolean poll()
If the behavior is active, it may use this method as a means to update its control of the robot. However, this is not required. The behavior may also use a separate thread or a timer to accomplish its control functions.
poll
in interface Behavior
public void setActive(boolean isActive)
When a behavior is active, it must take control of the robot. When a behavior is inactive, it must not attempt to control the robot.
setActive
in interface Behavior
isActive
- true if the behavior is being activated, otherwise falsepublic void setEnabled(boolean enabled)
When a behavior is disabled, its polling method is still called, but it must always return false from the poll method, indicating it is not interested in controlling the robot.
setEnabled
in interface Behavior2
enabled
- true if the behavior is being enabled, otherwise falsepublic void setListener(BehaviorListener listener)
setListener
in interface Behavior2
listener
- the BehaviorListener, or null to clear the listener
|
RoboJDETM v2.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |