org.argouml.model
Class AbstractStateMachinesHelperDecorator

java.lang.Object
  extended byorg.argouml.model.AbstractStateMachinesHelperDecorator
All Implemented Interfaces:
StateMachinesHelper
Direct Known Subclasses:
UndoStateMachinesHelperDecorator

public abstract class AbstractStateMachinesHelperDecorator
extends Object
implements StateMachinesHelper

An abstract Decorator for the StateMachinesHelper.


Method Summary
 void addDeferrableEvent(Object state, Object deferrableEvent)
          Add a deferrable event to a state.
 void addSubvertex(Object handle, Object subvertex)
          Add a subvertex to a composite state.
 Object findNamespaceForEvent(Object trans, Object model)
          Find the correct namespace for an event.
 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.
protected  StateMachinesHelper getComponent()
          The component we are decorating.
 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 removeDeferrableEvent(Object state, Object deferrableEvent)
          Remove a deferrable event from a 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 setChangeExpression(Object handle, Object value)
          Sets the change-expression for a ChangeEvent.
 void setConcurrent(Object handle, boolean concurrent)
          Makes a Composite State concurrent.
 void setContainer(Object handle, Object compositeState)
          Set the container of a statevertex.
 void setContext(Object statemachine, Object modelElement)
          Set the Context of a statemachine.
 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
 

Method Detail

getComponent

protected StateMachinesHelper getComponent()
The component we are decorating.

Returns:
Returns the component.

getSource

public Object getSource(Object trans)
Description copied from interface: StateMachinesHelper
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 StateMachinesHelper
Parameters:
trans - the given transition
Returns:
MStateVertex the source statevertex

getDestination

public Object getDestination(Object trans)
Description copied from interface: StateMachinesHelper
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 StateMachinesHelper
Parameters:
trans - the given transition
Returns:
MStateVertex the destination statevertex

getStateMachine

public Object getStateMachine(Object handle)
Description copied from interface: StateMachinesHelper
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 model implementation, the parameter of the method is of type Object, and the result, too.

Only if the given handle is null, then an exception is thrown.

Specified by:
getStateMachine in interface StateMachinesHelper
Parameters:
handle - The element for which we want to know the statemachine
Returns:
Object MStateMachine The statemachine the state belongs too or null if the given handle is not contained in this statemachine

setEventAsTrigger

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

Specified by:
setEventAsTrigger in interface StateMachinesHelper
Parameters:
transition - the given transition
event - the given event

isAddingStatemachineAllowed

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

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

isTopState

public boolean isTopState(Object o)
Description copied from interface: StateMachinesHelper
Returns true is the given state is the top state.

Specified by:
isTopState in interface StateMachinesHelper
Parameters:
o - CompositeState
Returns:
boolean

getAllPossibleStatemachines

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

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

getAllPossibleSubvertices

public Collection getAllPossibleSubvertices(Object oState)
Description copied from interface: StateMachinesHelper
Returns all states that can be recursively contained by the given State.

Specified by:
getAllPossibleSubvertices in interface 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)
Description copied from interface: StateMachinesHelper
Connects a given statemachine to a submachinestate as being the statemachine the submachinestate represents. To decouple ArgoUML as much as possible from the model implementation, the parameters of the method are of type Object.

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

getTop

public Object getTop(Object sm)
Description copied from interface: StateMachinesHelper
Get the "top" composite state of a statemachine.

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

getOutgoingStates

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

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

findOperationByName

public Object findOperationByName(Object trans,
                                  String opname)
Description copied from interface: StateMachinesHelper
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 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)
Description copied from interface: StateMachinesHelper
Returns all substates some composite state contains.

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

removeSubvertex

public void removeSubvertex(Object handle,
                            Object subvertex)
Description copied from interface: StateMachinesHelper
Remove a given subvertex from a given composite state.

Specified by:
removeSubvertex in interface StateMachinesHelper
Parameters:
handle - the composite state
subvertex - the StateVertex

addSubvertex

public void addSubvertex(Object handle,
                         Object subvertex)
Description copied from interface: StateMachinesHelper
Add a subvertex to a composite state.

Specified by:
addSubvertex in interface StateMachinesHelper
Parameters:
handle - the CompositeState
subvertex - the StateVertex

setBound

public void setBound(Object handle,
                     int bound)
Description copied from interface: StateMachinesHelper
Sets the Bound of some SynchState.

Specified by:
setBound in interface 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)
Description copied from interface: StateMachinesHelper
Makes a Composite State concurrent.

Specified by:
setConcurrent in interface StateMachinesHelper
Parameters:
handle - the CompositState
concurrent - boolean

setContainer

public void setContainer(Object handle,
                         Object compositeState)
Description copied from interface: StateMachinesHelper
Set the container of a statevertex.

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

setDoActivity

public void setDoActivity(Object handle,
                          Object value)
Description copied from interface: StateMachinesHelper
Sets the do activity of a state.

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

setEffect

public void setEffect(Object handle,
                      Object value)
Description copied from interface: StateMachinesHelper
Sets the effect of some transition.

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

setEntry

public void setEntry(Object handle,
                     Object value)
Description copied from interface: StateMachinesHelper
Sets the entry action of some state.

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

setExit

public void setExit(Object handle,
                    Object value)
Description copied from interface: StateMachinesHelper
Sets the exit action of some state.

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

setExpression

public void setExpression(Object handle,
                          Object value)
Description copied from interface: StateMachinesHelper
Set the Expression of a Guard or ChangeEvent.

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

setGuard

public void setGuard(Object handle,
                     Object guard)
Description copied from interface: StateMachinesHelper
Sets the guard of a transition.

Specified by:
setGuard in interface 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 StateMachinesHelper
Parameters:
handle - is the target.
intTrans - is a collection of transitions.

setSource

public void setSource(Object handle,
                      Object state)
Description copied from interface: StateMachinesHelper
Sets the source state of some message.

Specified by:
setSource in interface StateMachinesHelper
Parameters:
handle - the message
state - the source state

setState

public void setState(Object handle,
                     Object element)
Description copied from interface: StateMachinesHelper
Sets the state of an internal transition.

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

setStateMachine

public void setStateMachine(Object handle,
                            Object stm)
Description copied from interface: StateMachinesHelper
Sets a state machine of some state or transition.

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

setSubvertices

public void setSubvertices(Object handle,
                           Collection subvertices)
Description copied from interface: StateMachinesHelper
Set the collection of substates for a CompositeState.

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

setTrigger

public void setTrigger(Object handle,
                       Object event)
Description copied from interface: StateMachinesHelper
Sets the trigger event of a transition.

Specified by:
setTrigger in interface StateMachinesHelper
Parameters:
handle - is the transition
event - is the trigger event or null

setWhen

public void setWhen(Object handle,
                    Object value)
Description copied from interface: StateMachinesHelper
Sets the time-expression for a TimeEvent.

Specified by:
setWhen in interface StateMachinesHelper
Parameters:
handle - Object (TimeEvent)
value - Object (TimeExpression)

setChangeExpression

public void setChangeExpression(Object handle,
                                Object value)
Description copied from interface: StateMachinesHelper
Sets the change-expression for a ChangeEvent.

Specified by:
setChangeExpression in interface StateMachinesHelper
Parameters:
handle - Object (ChangeEvent)
value - Object (BooleanExpression)

getPath

public String getPath(Object o)
Description copied from interface: StateMachinesHelper
Returns the path of a state vertex.

Specified by:
getPath in interface StateMachinesHelper
Parameters:
o - the StateVertex
Returns:
String

getStatebyName

public Object getStatebyName(String path,
                             Object container)
Description copied from interface: StateMachinesHelper
Returns a state contained into container.

Specified by:
getStatebyName in interface StateMachinesHelper
Parameters:
path - The whole pathname of the state we are looking for.
container - of the state
Returns:
Object

setReferenceState

public void setReferenceState(Object o,
                              String referenced)
Description copied from interface: StateMachinesHelper
Sets the Referenced State of a StubState.

Specified by:
setReferenceState in interface StateMachinesHelper
Parameters:
o - Stub State
referenced - state

findNamespaceForEvent

public Object findNamespaceForEvent(Object trans,
                                    Object model)
Description copied from interface: StateMachinesHelper
Find the correct namespace for an event. This explained by the following quote from the UML spec: "The event declaration has scope within the package it appears in and may be used in state diagrams for classes that have visibility inside the package. An event is not local to a single class."

Specified by:
findNamespaceForEvent in interface StateMachinesHelper
Parameters:
trans - the transition of which the event is a trigger
model - the default is the model
Returns:
the enclosing namespace for the event

addDeferrableEvent

public void addDeferrableEvent(Object state,
                               Object deferrableEvent)
Description copied from interface: StateMachinesHelper
Add a deferrable event to a state.

Specified by:
addDeferrableEvent in interface StateMachinesHelper
Parameters:
state - The state.
deferrableEvent - The deferrable event.

removeDeferrableEvent

public void removeDeferrableEvent(Object state,
                                  Object deferrableEvent)
Description copied from interface: StateMachinesHelper
Remove a deferrable event from a state.

Specified by:
removeDeferrableEvent in interface StateMachinesHelper
Parameters:
state - The state.
deferrableEvent - The referrable event.

setContext

public void setContext(Object statemachine,
                       Object modelElement)
Description copied from interface: StateMachinesHelper
Set the Context of a statemachine.

Specified by:
setContext in interface StateMachinesHelper
Parameters:
statemachine - The state machine.
modelElement - The context.


ArgoUML © 1996-2006ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook