org.argouml.model.uml
Class StateMachinesHelperImpl

java.lang.Object
  extended byorg.argouml.model.uml.StateMachinesHelperImpl
All Implemented Interfaces:
org.argouml.model.StateMachinesHelper

class StateMachinesHelperImpl
extends Object
implements org.argouml.model.StateMachinesHelper

Helper class for UML BehavioralElements::StateMachines Package.

Since:
ARGO0.11.2

Field Summary
private  NSUMLModelImplementation nsmodel
          The model implementation.
 
Constructor Summary
(package private) StateMachinesHelperImpl(NSUMLModelImplementation implementation)
          Don't allow instantiation.
 
Method Summary
 void addSubvertex(Object handle, Object subvertex)
          Add a subvertex to a composite state.
 Object findOperationByName(Object trans, String opname)
          Finds the operation to which a CallEvent refers.
 Collection getAllPossibleStatemachines(Object model, Object oSubmachineState)
          Returns all statemachines that can be the statemachine the given submachinestate represents.
 Collection getAllPossibleSubvertices(Object oState)
          Returns all states that can be recursively contained by the given State.
 Collection getAllSubStates(Object compState)
          Returns all substates some composite state contains.
 Object getDestination(Object trans)
          Returns the destination of the given transition.
 Collection getOutgoingStates(Object ostatevertex)
          Gets all statevertices that are a target to transitions outgoing from the given statevertex.
 String getPath(Object o)
          Returns the path of a state vertex.
 Object getSource(Object trans)
          Returns the source of the given transition.
 Object getStatebyName(String path, Object container)
          Returns a state contained into container.
 Object getStateMachine(Object handle)
          Gets the statemachine that contains the given Object Traverses the state hierarchy of the statemachine untill the statemachine is reached.
 Object getTop(Object sm)
          Get the "top" composite state of a statemachine.
 boolean isAddingStatemachineAllowed(Object context)
          Returns true if a statemachine may be added to the given context.
 boolean isTopState(Object o)
          Returns true is the given state is the top state.
 void removeSubvertex(Object handle, Object subvertex)
          Remove a given subvertex from a given composite state.
 void setBound(Object handle, int bound)
          Sets the Bound of some SynchState.
 void setConcurrent(Object handle, boolean concurrent)
          Makes a Composite State concurrent.
 void setContainer(Object handle, Object compositeState)
          Set the container of a statevertex.
 void setDoActivity(Object handle, Object value)
          Sets the do activity of a state.
 void setEffect(Object handle, Object value)
          Sets the effect of some transition.
 void setEntry(Object handle, Object value)
          Sets the entry action of some state.
 void setEventAsTrigger(Object transition, Object event)
          Couples a given event to the given transition as being trigger event.
 void setExit(Object handle, Object value)
          Sets the exit action of some state.
 void setExpression(Object handle, Object value)
          Set the Expression of a Guard or ChangeEvent.
 void setGuard(Object handle, Object guard)
          Sets the guard of a transition.
 void setInternalTransitions(Object handle, Collection intTrans)
           
 void setReferenceState(Object o, String referenced)
          Sets the Referenced State of a StubState.
 void setSource(Object handle, Object state)
          Sets the source state of some message.
 void setState(Object handle, Object element)
          Sets the state of an internal transition.
 void setStateMachine(Object handle, Object stm)
          Sets a state machine of some state or transition.
 void setStatemachineAsSubmachine(Object oSubmachineState, Object oStatemachine)
          Connects a given statemachine to a submachinestate as being the statemachine the submachinestate represents.
 void setSubvertices(Object handle, Collection subvertices)
          Set the collection of substates for a CompositeState.
 void setTrigger(Object handle, Object event)
          Sets the trigger event of a transition.
 void setWhen(Object handle, Object value)
          Sets the time-expression for a TimeEvent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nsmodel

private NSUMLModelImplementation nsmodel
The model implementation.

Constructor Detail

StateMachinesHelperImpl

StateMachinesHelperImpl(NSUMLModelImplementation implementation)
Don't allow instantiation.

Parameters:
implementation - To get other helpers and factories.
Method Detail

getSource

public Object getSource(Object trans)
Returns the source of the given transition. This operation is here to give a full implementation of all getSource and getDestination methods on the uml helpers.

Specified by:
getSource in interface org.argouml.model.StateMachinesHelper
Parameters:
trans - the given transition
Returns:
MStateVertex the source statevertex

getDestination

public Object getDestination(Object trans)
Returns the destination of the given transition. This operation is here to give a full implementation of all getSource and getDestination methods on the uml helpers.

Specified by:
getDestination in interface org.argouml.model.StateMachinesHelper
Parameters:
trans - the given transition
Returns:
MStateVertex the destination statevertex

getStateMachine

public Object getStateMachine(Object handle)
Gets the statemachine that contains the given Object Traverses the state hierarchy of the statemachine untill the statemachine is reached. To decouple ArgoUML as much as possible from the NSUML model, the parameter of the method is of type Object, and the result, too.

Specified by:
getStateMachine in interface org.argouml.model.StateMachinesHelper
Parameters:
handle - The state for which we want to know the statemachine
Returns:
Object MStateMachine The statemachine the state belongs too or null if the given parameter is not a state or null itself.

setEventAsTrigger

public void setEventAsTrigger(Object transition,
                              Object event)
Couples a given event to the given transition as being trigger event. To decouple ArgoUML as much as possible from the NSUML model, the parameters of the method are of type Object.

Specified by:
setEventAsTrigger in interface org.argouml.model.StateMachinesHelper
Parameters:
transition - the given transition
event - the given event

isAddingStatemachineAllowed

public boolean isAddingStatemachineAllowed(Object context)
Returns true if a statemachine may be added to the given context. To decouple ArgoUML as much as possible from the NSUML model, the parameter of the method is of type Object.

Specified by:
isAddingStatemachineAllowed in interface org.argouml.model.StateMachinesHelper
Parameters:
context - the given context
Returns:
boolean true if a statemachine may be added

isTopState

public boolean isTopState(Object o)
Returns true is the given state is the top state.

Specified by:
isTopState in interface org.argouml.model.StateMachinesHelper
Parameters:
o - CompositeState
Returns:
boolean

getAllPossibleStatemachines

public Collection getAllPossibleStatemachines(Object model,
                                              Object oSubmachineState)
Returns all statemachines that can be the statemachine the given submachinestate represents. To decouple ArgoUML as much as possible from the NSUML model, the parameter of the method is of type Object.

Specified by:
getAllPossibleStatemachines in interface org.argouml.model.StateMachinesHelper
Parameters:
model - The model where we search for state machines.
oSubmachineState - The submachinestate we are searching the statemachines for.
Returns:
Collection The collection with found statemachines.

getAllPossibleSubvertices

public Collection getAllPossibleSubvertices(Object oState)
Returns all states that can be recursively contained by the given State.

Specified by:
getAllPossibleSubvertices in interface org.argouml.model.StateMachinesHelper
Parameters:
oState - the Composite state we are searching the states for
Returns:
Collection the collection with found states

setStatemachineAsSubmachine

public void setStatemachineAsSubmachine(Object oSubmachineState,
                                        Object oStatemachine)
Connects a given statemachine to a submachinestate as being the statemachine the submachinestate represents. To decouple ArgoUML as much as possible from the NSUML model, the parameters of the method are of type Object.

Specified by:
setStatemachineAsSubmachine in interface org.argouml.model.StateMachinesHelper
Parameters:
oSubmachineState - The submachinestate for which we want to set the property submachine
oStatemachine - The statemachine

getTop

public Object getTop(Object sm)
Get the "top" composite state of a statemachine.

Specified by:
getTop in interface org.argouml.model.StateMachinesHelper
Parameters:
sm - the given statemachine
Returns:
the top composite state

getOutgoingStates

public Collection getOutgoingStates(Object ostatevertex)
Gets all statevertices that are a target to transitions outgoing from the given statevertex.

Specified by:
getOutgoingStates in interface org.argouml.model.StateMachinesHelper
Parameters:
ostatevertex - the given statevertex
Returns:
Collection all statevertices that are a target

findOperationByName

public Object findOperationByName(Object trans,
                                  String opname)
Finds the operation to which a CallEvent refers. TODO: This function works for the most normal cases, but needs some testing for rare cases, e.g. internal transitions,...

Specified by:
findOperationByName in interface org.argouml.model.StateMachinesHelper
Parameters:
trans - Object of type MTransition
opname - the name of the operation sought
Returns:
Object The operation with the given name, or null.

getAllSubStates

public Collection getAllSubStates(Object compState)
Returns all substates some composite state contains.

Specified by:
getAllSubStates in interface org.argouml.model.StateMachinesHelper
Parameters:
compState - the given compositestate
Returns:
all substates

removeSubvertex

public void removeSubvertex(Object handle,
                            Object subvertex)
Remove a given subvertex from a given composite state.

Specified by:
removeSubvertex in interface org.argouml.model.StateMachinesHelper
Parameters:
handle - the composite state
subvertex - the StateVertex

addSubvertex

public void addSubvertex(Object handle,
                         Object subvertex)
Add a subvertex to a composite state.

Specified by:
addSubvertex in interface org.argouml.model.StateMachinesHelper
Parameters:
handle - the CompositeState
subvertex - the StateVertex

setBound

public void setBound(Object handle,
                     int bound)
Sets the Bound of some SynchState.

Specified by:
setBound in interface org.argouml.model.StateMachinesHelper
Parameters:
handle - Synch State
bound - A positive integer or the value “unlimited” specifying the maximal count of the SynchState. The count is the difference between the number of times the incoming and outgoing transitions of the synch state are fired.

setConcurrent

public void setConcurrent(Object handle,
                          boolean concurrent)
Makes a Composite State concurrent.

Specified by:
setConcurrent in interface org.argouml.model.StateMachinesHelper
Parameters:
handle - the CompositState
concurrent - boolean

setContainer

public void setContainer(Object handle,
                         Object compositeState)
Set the container of a statevertex.

Specified by:
setContainer in interface org.argouml.model.StateMachinesHelper
Parameters:
handle - is the stateVertex
compositeState - is the container. Can be null.

setDoActivity

public void setDoActivity(Object handle,
                          Object value)
Sets the do activity of a state.

Specified by:
setDoActivity in interface org.argouml.model.StateMachinesHelper
Parameters:
handle - is the state
value - the activity. Can be null.

setEffect

public void setEffect(Object handle,
                      Object value)
Sets the effect of some transition.

Specified by:
setEffect in interface org.argouml.model.StateMachinesHelper
Parameters:
handle - is the transition
value - is the effect. Can be null.

setEntry

public void setEntry(Object handle,
                     Object value)
Sets the entry action of some state.

Specified by:
setEntry in interface org.argouml.model.StateMachinesHelper
Parameters:
handle - is the state
value - is the action. Can be null.

setExit

public void setExit(Object handle,
                    Object value)
Sets the exit action of some state.

Specified by:
setExit in interface org.argouml.model.StateMachinesHelper
Parameters:
handle - is the state
value - is the action. Can be null.

setExpression

public void setExpression(Object handle,
                          Object value)
Set the Expression of a Guard or ChangeEvent.

Specified by:
setExpression in interface org.argouml.model.StateMachinesHelper
Parameters:
handle - Guard or ChangeEvent
value - BooleanExpression or null

setGuard

public void setGuard(Object handle,
                     Object guard)
Sets the guard of a transition.

Specified by:
setGuard in interface org.argouml.model.StateMachinesHelper
Parameters:
handle - to the transition
guard - to be set. Can be null.

setInternalTransitions

public void setInternalTransitions(Object handle,
                                   Collection intTrans)
Specified by:
setInternalTransitions in interface org.argouml.model.StateMachinesHelper
Parameters:
handle - is the target.
intTrans - is a collection of transitions.

setSource

public void setSource(Object handle,
                      Object state)
Sets the source state of some message.

Specified by:
setSource in interface org.argouml.model.StateMachinesHelper
Parameters:
handle - the message
state - the source state

setState

public void setState(Object handle,
                     Object element)
Sets the state of an internal transition.

Specified by:
setState in interface org.argouml.model.StateMachinesHelper
Parameters:
handle - the internal transition
element - the state that contains this transition

setStateMachine

public void setStateMachine(Object handle,
                            Object stm)
Sets a state machine of some state or transition.

Specified by:
setStateMachine in interface org.argouml.model.StateMachinesHelper
Parameters:
handle - is the state or transition
stm - is the state machine

setSubvertices

public void setSubvertices(Object handle,
                           Collection subvertices)
Set the collection of substates for a CompositeState.

Specified by:
setSubvertices in interface org.argouml.model.StateMachinesHelper
Parameters:
handle - CompositeState
subvertices - collection of sub-StateVertexes

setTrigger

public void setTrigger(Object handle,
                       Object event)
Sets the trigger event of a transition.

Specified by:
setTrigger in interface org.argouml.model.StateMachinesHelper
Parameters:
handle - is the transition
event - is the trigger event

setWhen

public void setWhen(Object handle,
                    Object value)
Sets the time-expression for a TimeEvent.

Specified by:
setWhen in interface org.argouml.model.StateMachinesHelper
Parameters:
handle - Object (MTimeEvent)
value - Object (MTimeExpression)

getPath

public String getPath(Object o)
Returns the path of a state vertex.

Specified by:
getPath in interface org.argouml.model.StateMachinesHelper
Parameters:
o - the StateVertex
Returns:
String

getStatebyName

public Object getStatebyName(String path,
                             Object container)
Returns a state contained into container. path is the whole pathname of the state we are looking for.

Specified by:
getStatebyName in interface org.argouml.model.StateMachinesHelper
Parameters:
path - the path the state
container - of the state
Returns:
Object

setReferenceState

public void setReferenceState(Object o,
                              String referenced)
Sets the Referenced State of a StubState.

Specified by:
setReferenceState in interface org.argouml.model.StateMachinesHelper
Parameters:
o - Stub State
referenced - state


ArgoUML © 1996-2004 (20050222)ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook