Package cruise.umple.compiler
Class StateWrapper
java.lang.Object
cruise.umple.compiler.StateWrapper
public class StateWrapper
extends java.lang.Object
A simple wrapper over a State machine's states that allows keeping track
of the parent state of the wrapped state, and all events that will cause
a transition out of the wrapped state.
-
Constructor Summary
Constructors Constructor Description StateWrapper(State aWrappedState, int aStateId)
-
Method Summary
Modifier and Type Method Description boolean
addEvent(EventWrapper aEvent)
boolean
addEventAt(EventWrapper aEvent, int index)
void
addMappedTransistion(Event event, Transition transition)
Adds an event and the transition it maps to for this state to the eventMapboolean
addOrMoveEventAt(EventWrapper aEvent, int index)
void
delete()
java.lang.String
getDashedName()
Returns the name of this state, accounting for nested depth.java.lang.String
getDottedName()
Returns the name of this state, accounting for parent states.EventWrapper
getEvent(int index)
java.util.List<EventWrapper>
getEvents()
Transition
getMappedTransition(Event event, java.util.Random randomGen)
Returns one of the transitions caused by this event using the injected Random number generatorStateWrapper
getParent()
java.lang.String
getParentId()
Returns the id value of this states parent, or the empty string, if this has no parentEvent[]
getPossibleEvents()
returns an array of possible eventsint
getStateId()
State
getWrappedState()
boolean
hasEvents()
boolean
hasParent()
int
indexOfEvent(EventWrapper aEvent)
boolean
isEndState()
If no possible events exist to exit this state, then the wrapped state is an end state.static int
minimumNumberOfEvents()
int
numberOfEvents()
boolean
removeEvent(EventWrapper aEvent)
boolean
setParent(StateWrapper aNewParent)
boolean
setStateId(int aStateId)
boolean
setWrappedState(State aWrappedState)
java.lang.String
toString()
-
Constructor Details
-
Method Details
-
setWrappedState
-
setStateId
public boolean setStateId(int aStateId) -
getWrappedState
-
getStateId
public int getStateId() -
getParent
-
hasParent
public boolean hasParent() -
getEvent
-
getEvents
-
numberOfEvents
public int numberOfEvents() -
hasEvents
public boolean hasEvents() -
indexOfEvent
-
setParent
-
minimumNumberOfEvents
public static int minimumNumberOfEvents() -
addEvent
-
removeEvent
-
addEventAt
-
addOrMoveEventAt
-
delete
public void delete() -
isEndState
public boolean isEndState()If no possible events exist to exit this state, then the wrapped state is an end state. -
addMappedTransistion
Adds an event and the transition it maps to for this state to the eventMap -
getMappedTransition
Returns one of the transitions caused by this event using the injected Random number generator -
getPossibleEvents
returns an array of possible events -
getDottedName
public java.lang.String getDottedName()Returns the name of this state, accounting for parent states. The parent state names are added as prefixes, separated by dots. -
getDashedName
public java.lang.String getDashedName()Returns the name of this state, accounting for nested depth. For each level of nesting this state is in, a dash is prefixed to the name -
getParentId
public java.lang.String getParentId()Returns the id value of this states parent, or the empty string, if this has no parent -
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-