EASE.Agents.Engine
Class StateMachine

java.lang.Object
  |
  +--EASE.Agents.Engine.StateMachine

class StateMachine
extends java.lang.Object

This is currently the state machine used by both managers and engineers it is ugly because satisfactions are particular to engineers and contracts particular to managers but this is only handled by leaving one of them null.


Field Summary
private  Debugger debugger
           
private  EnvironmentImport e
           
private  int startIndex
           
private  java.util.Vector states
           
private  java.util.Vector transitionInstantiatedParams
           
 
Constructor Summary
StateMachine(java.util.Vector statesS, java.util.Vector transitionsS, Engine sensing)
          Deprecated. Use version with name for debugging purposes.
 
Method Summary
 int execute(java.util.Hashtable params, int state)
           
 int execute(java.util.Hashtable params, int state, boolean contractFailing, boolean allSuccess)
          Ask the stateMachine to see if it should change states.
 int execute(java.util.Hashtable params, int state, boolean contractFailing, boolean allSuccess, java.lang.StringBuffer sb)
          Traceable version of execute
 int execute(java.util.Hashtable params, int state, java.lang.StringBuffer sb)
           
 java.util.Vector getContracts(int state)
          Get the made contracts for some state.
 java.util.Vector getFactories(int state)
          Get the factories for registration in some state.
 InstantiatedSM getInstantiated()
          Get an instantiation of this state machine.
 java.util.Vector getInstantiatedParams()
          Get all the instantiations of parameters for the SM
 ListSensorData getListType()
          Returns a ListSensor Type if there is one involved with this SM.
 java.lang.String getName(int state)
          Get the name of some state.
 double getOutputSatisfaction(java.lang.String name, java.util.Hashtable params, java.lang.Object proposal, int state)
          Actually does the same as getSatisfaction, difference is only so that the state can work out whether its failing or not (i.e.
 double getSatisfaction(java.lang.String name, java.util.Hashtable params, java.lang.Object proposal, int state)
          I can't get no satisfaction .
 double getSatisfaction(java.lang.String name, java.util.Hashtable params, java.lang.Object proposal, int state, java.lang.StringBuffer sb)
           
 int getStartState()
          Get the starting state of the state machine
 boolean isFailing(int state)
          Returns whether the state is failing.
 boolean isSuccess(int state)
          Returns whether the state is a success(final) state.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

e

private EnvironmentImport e

states

private java.util.Vector states

startIndex

private int startIndex

debugger

private Debugger debugger

transitionInstantiatedParams

private java.util.Vector transitionInstantiatedParams
Constructor Detail

StateMachine

public StateMachine(java.util.Vector statesS,
                    java.util.Vector transitionsS,
                    Engine sensing)
Deprecated. Use version with name for debugging purposes.
Constructor Given vectors containing states and transitions in saved format (i.e. from Agents.Sensing)
Method Detail

getSatisfaction

public double getSatisfaction(java.lang.String name,
                              java.util.Hashtable params,
                              java.lang.Object proposal,
                              int state)
I can't get no satisfaction . . (without this function)

getOutputSatisfaction

public double getOutputSatisfaction(java.lang.String name,
                                    java.util.Hashtable params,
                                    java.lang.Object proposal,
                                    int state)
Actually does the same as getSatisfaction, difference is only so that the state can work out whether its failing or not (i.e. only matters if output)

getSatisfaction

public double getSatisfaction(java.lang.String name,
                              java.util.Hashtable params,
                              java.lang.Object proposal,
                              int state,
                              java.lang.StringBuffer sb)

execute

public int execute(java.util.Hashtable params,
                   int state,
                   boolean contractFailing,
                   boolean allSuccess)
Ask the stateMachine to see if it should change states.

Given parameters and the current state.

For an engineer the contract failing parameter is irrelevant. It only applies to managers that have contracts. Returns a new state.


execute

public int execute(java.util.Hashtable params,
                   int state)

execute

public int execute(java.util.Hashtable params,
                   int state,
                   java.lang.StringBuffer sb)

execute

public int execute(java.util.Hashtable params,
                   int state,
                   boolean contractFailing,
                   boolean allSuccess,
                   java.lang.StringBuffer sb)
Traceable version of execute

getInstantiated

public InstantiatedSM getInstantiated()
Get an instantiation of this state machine.


getStartState

public int getStartState()
Get the starting state of the state machine

getFactories

public java.util.Vector getFactories(int state)
Get the factories for registration in some state.


getContracts

public java.util.Vector getContracts(int state)
Get the made contracts for some state.


getName

public java.lang.String getName(int state)
Get the name of some state.


getInstantiatedParams

public java.util.Vector getInstantiatedParams()
Get all the instantiations of parameters for the SM

getListType

public ListSensorData getListType()
Returns a ListSensor Type if there is one involved with this SM.

Assumes there is only one.


isFailing

public boolean isFailing(int state)
Returns whether the state is failing.

Does NOT consider whether contracts are failing (done in instantiated SM).


isSuccess

public boolean isSuccess(int state)
Returns whether the state is a success(final) state.