|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.generation5.ai.FSM.State
The FSM states. The default FSM State simply stores a hash table with transitions along with a state name.
| Field Summary | |
protected double |
positionX
The X-position of the state. |
protected double |
positionY
The Y-position of the state. |
protected boolean |
selfReferring
Specifies whether this FSM node is self-referential. |
protected java.lang.String |
stateName
The name of the state. |
protected java.util.Hashtable |
transitionHash
The hash table that stores the transitions. |
| Constructor Summary | |
FSM.State()
Create a new instance of State. |
|
FSM.State(java.lang.String name)
Create a new instance of State, with the state name. |
|
FSM.State(java.lang.String name,
double x,
double y)
Create a new instance of the State with name and positional information. |
|
| Method Summary | |
void |
addTransition(int transition,
FSM.State endState)
Add a transition to the state. |
double |
getPositionX()
Retrieve the x-position of the state. |
double |
getPositionY()
Retrieve the y-position of the state. |
boolean |
isSelfReferring()
Is this node self-referential? |
void |
render(java.awt.Graphics g,
int width,
int height,
int size)
Renders the state. |
void |
renderConnections(java.awt.Graphics g,
int width,
int height,
int size)
Render the connections from this state. |
void |
setName(java.lang.String name)
Set the name of the state post-construction. |
void |
setPosition(double x,
double y)
Set the position of the state. |
void |
setSelfReferring(boolean sr)
Sets whether the node is self-referential or not. |
java.lang.String |
toString()
Returns the name of the state. |
FSM.State |
transition(int transition)
Transition this state given the transition identifier. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected java.lang.String stateName
protected java.util.Hashtable transitionHash
protected double positionX
protected double positionY
protected boolean selfReferring
| Constructor Detail |
public FSM.State()
public FSM.State(java.lang.String name)
name - the state name.
public FSM.State(java.lang.String name,
double x,
double y)
name - the state name.x - the x-position of the state.y - the y-position of the state.| Method Detail |
public void setName(java.lang.String name)
name - the name of the state.public boolean isSelfReferring()
public void setSelfReferring(boolean sr)
sr - true if self-referential, otherwise false.
public void addTransition(int transition,
FSM.State endState)
transition - the transition identifier.endState - the end state.public FSM.State transition(int transition)
transition - the transition identifier.
public java.lang.String toString()
public void setPosition(double x,
double y)
IllegalArgumentException will be
thrown if either position is less than 0.0 or greater than 1.0.
x - the x-position of the state.y - the y-position of the state.public double getPositionX()
public double getPositionY()
public void renderConnections(java.awt.Graphics g,
int width,
int height,
int size)
g - the graphics context.width - the width of the context.height - the height of the context.size - the size of the states.
public void render(java.awt.Graphics g,
int width,
int height,
int size)
setPosition. Positions are specified using a double
between 0.0 and 1.0 (for example, setPosition(0.5, 0.5) will render
the state in the centre of the graphics context).
g - the graphics context.width - the width of the context.height - the height of the context.size - the size of the state.
|
This documentation is part of the Generation5 JDK.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||