>xabsl   The Extensible Agent Behavior Specification Language

XabslEngine Class Library Reference

 

xabsl::State Class Reference

#include <XabslState.h>

Inheritance diagram for xabsl::State:

Inheritance graph
[legend]
Collaboration diagram for xabsl::State:

Collaboration graph
[legend]
List of all members.

Detailed Description

Represents a single state written in.

Author:
Martin Loetzsch

Definition at line 32 of file XabslState.h.


Public Member Functions

 State (const char *name, ErrorHandler &errorHandler, const unsigned &time, int optionIndex, int index)
 Constructor.

 ~State ()
 Destructor.

void create (InputSource &input, NamedArray< Option * > &options, NamedArray< BasicBehavior * > &basicBehaviors, NamedArray< State * > &states, Symbols &symbols)
 Creates the state and it's subelements from the intermediate code.

virtual StategetNextState ()
 Executes the decision tree and determines the next active state (can be the same).

void reset ()
 Sets the time when the state was activated to 0.

bool isTargetState () const
 Returns wheter the state is a target state.

virtual bool coopCheck ()
 Check whether this state can be entered, or whether entering is blocked due to cooperating agents.

virtual bool getConflict ()
 Whether this state is currently conflicted, i.e whether cooperation conditions are violated.


Public Attributes

Array< Action * > actions
 The actions of the state.

OptionsubsequentOption
 The first subsequent option that is executed after that option if the state is active.

unsigned timeOfStateExecution
 The time how long the state is already active.

int index
 Index of the state in array states in corresponding option.

unsigned timeWhenStateWasActivated
 The time, when the state was activated.

int optionIndex
 Index of the corresponding option this state belongs to.


Protected Attributes

bool targetState
 If true, the state is a target state.

ErrorHandlererrorHandler
 Used for error handling.

StatementdecisionTree
 The root element of the decision tree.

const unsigned & time
 The system time in ms.


Constructor & Destructor Documentation

xabsl::State::State const char *  name,
ErrorHandler errorHandler,
const unsigned &  time,
int  optionIndex,
int  index
 

Constructor.

Does not create the state.

Parameters:
name The name of the state. For debugging purposes.
errorHandler A reference to a ErrorHandler instance
time The system time in ms.
optionIndex Index of the corresponding option this state belongs to
index Index of the state in array states in corresponding option

Definition at line 20 of file XabslState.cpp.

xabsl::State::~State  ) 
 

Destructor.

Definition at line 34 of file XabslState.cpp.

References actions, decisionTree, and xabsl::Array< Action * >::getSize().

Here is the call graph for this function:


Member Function Documentation

void xabsl::State::create InputSource input,
NamedArray< Option * > &  options,
NamedArray< BasicBehavior * > &  basicBehaviors,
NamedArray< State * > &  states,
Symbols symbols
 

Creates the state and it's subelements from the intermediate code.

Parameters:
input An input source for the intermediate code. It must be opened and read until A position where a state starts.
options All available options
basicBehaviors All available basicBehaviors
states All states of the option
symbols All available symbols

Definition at line 41 of file XabslState.cpp.

References actions, xabsl::Array< Action * >::append(), decisionTree, xabsl::ErrorHandler::error(), xabsl::ErrorHandler::errorsOccurred, xabsl::ErrorHandler::message(), xabsl::ActionOption::option, optionIndex, xabsl::InputSource::readString(), xabsl::InputSource::readValue(), subsequentOption, targetState, and XABSL_DEBUG_INIT.

Here is the call graph for this function:

State * xabsl::State::getNextState  )  [virtual]
 

Executes the decision tree and determines the next active state (can be the same).

Reimplemented in xabsl::CapacityState.

Definition at line 91 of file XabslState.cpp.

References coopCheck(), decisionTree, xabsl::Statement::getNextState(), timeOfStateExecution, and timeWhenStateWasActivated.

Referenced by xabsl::Option::execute().

Here is the call graph for this function:

void xabsl::State::reset  ) 
 

Sets the time when the state was activated to 0.

Definition at line 100 of file XabslState.cpp.

References timeOfStateExecution, and timeWhenStateWasActivated.

Referenced by xabsl::Option::execute().

bool xabsl::State::isTargetState  )  const
 

Returns wheter the state is a target state.

Definition at line 106 of file XabslState.cpp.

References targetState.

Referenced by xabsl::Option::getOptionReachedATargetState().

virtual bool xabsl::State::coopCheck  )  [inline, virtual]
 

Check whether this state can be entered, or whether entering is blocked due to cooperating agents.

Reimplemented in xabsl::SynchronizedState, and xabsl::CapacityState.

Definition at line 101 of file XabslState.h.

Referenced by getNextState().

virtual bool xabsl::State::getConflict  )  [inline, virtual]
 

Whether this state is currently conflicted, i.e whether cooperation conditions are violated.

Reimplemented in xabsl::CapacityState.

Definition at line 104 of file XabslState.h.

Referenced by xabsl::ConflictCondition::getValue().


Member Data Documentation

Array<Action*> xabsl::State::actions
 

The actions of the state.

Definition at line 73 of file XabslState.h.

Referenced by create(), xabsl::Option::execute(), xabsl::SubsequentOptionReachedTargetStateCondition::getValue(), and ~State().

Option* xabsl::State::subsequentOption
 

The first subsequent option that is executed after that option if the state is active.

If 0, no subsequent option is executed after that option. This pointer is present just for compatibility reasons, please use getactions instead

Definition at line 80 of file XabslState.h.

Referenced by create().

unsigned xabsl::State::timeOfStateExecution
 

The time how long the state is already active.

Definition at line 83 of file XabslState.h.

Referenced by xabsl::DecimalExpression::create(), getNextState(), and reset().

int xabsl::State::index
 

Index of the state in array states in corresponding option.

Definition at line 92 of file XabslState.h.

unsigned xabsl::State::timeWhenStateWasActivated
 

The time, when the state was activated.

Definition at line 95 of file XabslState.h.

Referenced by getNextState(), and reset().

int xabsl::State::optionIndex
 

Index of the corresponding option this state belongs to.

Definition at line 98 of file XabslState.h.

Referenced by create().

bool xabsl::State::targetState [protected]
 

If true, the state is a target state.

Definition at line 109 of file XabslState.h.

Referenced by create(), and isTargetState().

ErrorHandler& xabsl::State::errorHandler [protected]
 

Used for error handling.

Definition at line 112 of file XabslState.h.

Statement* xabsl::State::decisionTree [protected]
 

The root element of the decision tree.

Definition at line 115 of file XabslState.h.

Referenced by create(), getNextState(), and ~State().

const unsigned& xabsl::State::time [protected]
 

The system time in ms.

Definition at line 118 of file XabslState.h.


The documentation for this class was generated from the following files:

Up | Main Page | Generated at Wed Aug 19 17:32:31 2009.