de.xabsl.jxabsl.behavior
Class Option

java.lang.Object
  extended by de.xabsl.jxabsl.symbols.NamedItem
      extended by de.xabsl.jxabsl.behavior.Behavior
          extended by de.xabsl.jxabsl.behavior.Option

public class Option
extends Behavior

Represents a single option


Field Summary
protected  State activeState
           
protected  State initialState
           
protected  java.util.LinkedHashMap<java.lang.String,State> states
           
protected  TimeFunction timeFunction
           
 
Fields inherited from class de.xabsl.jxabsl.behavior.Behavior
active, parameters, timeOfExecution, timeWhenActivated, tOE, wasActive
 
Fields inherited from class de.xabsl.jxabsl.symbols.NamedItem
debug, name
 
Constructor Summary
Option(java.lang.String name, InputSource input, DebugMessages debug, Symbols symbols, TimeFunction timeFunction)
          Constructor.
 
Method Summary
 void create(InputSource input, java.util.Map<java.lang.String,Option> options, Engine engine)
          Creates the option and its states from the intermediate code.
 void execute()
          executes the behavior
 State getActiveState()
           
 boolean getOptionReachedATargetState()
          if a target state was reached
 java.util.LinkedHashMap<java.lang.String,State> getStates()
           
 
Methods inherited from class de.xabsl.jxabsl.behavior.Behavior
getParameters, getTimeOfExecution, getTimeWhenActivated, isActive, setActive, setTimeOfExecution, setTimeWhenActivated, setWasActive, wasActive
 
Methods inherited from class de.xabsl.jxabsl.symbols.NamedItem
getName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

activeState

protected State activeState

initialState

protected State initialState

timeFunction

protected TimeFunction timeFunction

states

protected java.util.LinkedHashMap<java.lang.String,State> states
Constructor Detail

Option

public Option(java.lang.String name,
              InputSource input,
              DebugMessages debug,
              Symbols symbols,
              TimeFunction timeFunction)
Constructor. Does not create the option.

Parameters:
name - The name of the option. For debugging purposes.
input - An input source for the intermediate code. It must be opened and read until A position where an option starts.
debug - Print debugging messages
symbols - All available symbols
timeFunction - a pointer to a function that returns the system time in ms.
Method Detail

create

public void create(InputSource input,
                   java.util.Map<java.lang.String,Option> options,
                   Engine engine)
            throws IntermediateCodeMalformedException
Creates the option and its states from the intermediate code.

Parameters:
input - An input source for the intermediate code. It must be opened and read until a position where an option starts.
options - All other options
engine - The engine that provides symbols and basic behaviors
Throws:
IntermediateCodeMalformedException

getOptionReachedATargetState

public boolean getOptionReachedATargetState()
if a target state was reached


execute

public void execute()
Description copied from class: Behavior
executes the behavior

Specified by:
execute in class Behavior

getStates

public java.util.LinkedHashMap<java.lang.String,State> getStates()

getActiveState

public State getActiveState()