com.telelogic.rhapsody.core
Interface IRPState

All Superinterfaces:
IRPModelElement, IRPStateVertex
All Known Subinterfaces:
IRPAcceptEventAction, IRPAcceptTimeEvent, IRPCallOperation, IRPObjectNode

public interface IRPState
extends IRPStateVertex

The IRPState interface represents states in a statechart.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.telelogic.rhapsody.core.IRPModelElement
IRPModelElement.OSLCLink
 
Method Summary
 IRPState addActivityFinal()
          Adds an ActivityFinal element to an Activity.
 IRPConnector addConnector(java.lang.String type)
          Adds a connector element of the specified type to the state.
 IRPTransition addInternalTransition(IRPInterfaceItem trigger)
          method addInternalTransition
 IRPState addState(java.lang.String name)
          Adds a new substate to this state.
 IRPTransition addStaticReaction(IRPInterfaceItem trigger)
          Adds an internal transition to the state.
 IRPState addTerminationState()
          Adds a termination state to a statechart.
 IRPTransition createDefaultTransition(IRPState from)
          Creates a default transition within the state.
 IRPStatechart createNestedStatechart()
          Creates a sub-statechart for the state.
 void deleteConnector(IRPConnector connector)
          Deletes the specified connector element.
 void deleteInternalTransition(IRPTransition pVal)
          method deleteInternalTransition
 void deleteStaticReaction(IRPTransition pVal)
          Deletes the specified internal transition.
 IRPTransition getDefaultTransition()
          Returns the default transition within the state.
 java.lang.String getEntryAction()
          Returns the entry action that was defined for the state.
 java.lang.String getExitAction()
          Returns the exit action that was defined for the state.
 java.lang.String getFullNameInStatechart()
          Returns the full name of the state within the statechart, including information about its hierarchical position within the statechart.
 IRPState getInheritsFrom()
          Returns the corresponding state from the statechart of the class that this class is derived from.
 IRPCollection getInternalTransitions()
          Returns a collection of the state's internal transitions.
 int getIsOverridden()
          Checks whether there is still an inheritance relationship between this state and the corresponding state from the statechart of the class that this class is derived from.
 int getIsReferenceActivity()
          Checks whether this element is a call behavior element.
 IRPStatechart getItsStatechart()
          Returns the statechart that this state belongs to.
 IRPSwimlane getItsSwimlane()
          Returns the swimlane that the action is located in.
 IRPCollection getLogicalStates()
          Returns a collection of all the substates of the current state and all the first-level substates of those states, meaning down to the second level.
 IRPStatechart getNestedStatechart()
          Returns the state's sub-statechart.
 IRPModelElement getReferenceToActivity()
          For call behavior elements, returns the activity that is referenced.
 IRPSendAction getSendAction()
          Returns the Send Action element associated with the state.
 java.lang.String getStateType()
          Returns the type of the state, for example, an And state or a Termination state.
 IRPCollection getStaticReactions()
          Returns a collection of the state's internal transitions.
 IRPCollection getSubStates()
          Returns a collection of the substates contained in this state.
 IRPCollection getSubStateVertices()
          Returns a collection of all the first-level elements contained in this state - this includes both node elements and connector elements.
 IRPAction getTheEntryAction()
          method getTheEntryAction
 IRPAction getTheExitAction()
          method getTheExitAction
 int isAnd()
          Checks whether the state contains one or more And Lines.
 int isCompound()
          Checks whether the state is a compound state, meaning a state that contains one or more substates.
 int isLeaf()
          Checks whether the state is a leaf state, meaning a state that does not contain any substates.
 int isRoot()
          Checks whether the state is the root state of the statechart.
 int isSendActionState()
          Checks whether the state is a Send Action element.
 void overrideInheritance()
          Breaks the inheritance relationship between this state and the corresponding state from the statechart of the class that this class is derived from.
 IRPState resetEntryActionInheritance()
          Restores the inheritance relationship between this state and the corresponding state from the statechart of the class that this class is derived from, for the entry action.
 IRPState resetExitActionInheritance()
          Restores the inheritance relationship between this state and the corresponding state from the statechart of the class that this class is derived from, for the exit action.
 void setEntryAction(java.lang.String entryAction)
          Sets the entry action for the state.
 void setExitAction(java.lang.String exitAction)
          Sets the exit action for the state.
 void setInternalTransition(java.lang.String trigVal, java.lang.String guardVal, java.lang.String actionVal)
          method setInternalTransition
 void setItsSwimlane(IRPSwimlane itsSwimlane)
          Specifies the swimlane that the action should be in
 void setReferenceToActivity(IRPModelElement referenceToActivity)
          For call behavior elements, sets the activity that is referenced by the element.
 void setStateType(java.lang.String stateType)
          Specifies the type of the state
 void setStaticReaction(java.lang.String trigVal, java.lang.String guardVal, java.lang.String actionVal)
          Adds a new internal transition to the state.
 void unoverrideInheritance()
          Restores the inheritance relationship between this state and the corresponding state from the statechart of the class that this class is derived from.
 
Methods inherited from interface com.telelogic.rhapsody.core.IRPStateVertex
addFlow, addTransition, deleteTransition, getInTransitions, getOutTransitions, getParent, setParent
 
Methods inherited from interface com.telelogic.rhapsody.core.IRPModelElement
addAssociation, addDependency, addDependencyBetween, addDependencyTo, addLinkToElement, addNewAggr, addProperty, addRedefines, addRemoteDependencyTo, addSpecificStereotype, addStereotype, becomeTemplateInstantiationOf, changeTo, clone, createOSLCLink, deleteDependency, deleteFromProject, deleteOSLCLink, errorMessage, findElementsByFullName, findNestedElement, findNestedElementRecursive, getAllTags, getAnnotations, getAssociationClasses, getBinaryID, getConstraints, getConstraintsByHim, getControlledFiles, getDecorationStyle, getDependencies, getDescription, getDescriptionHTML, getDescriptionPlainText, getDescriptionRTF, getDisplayName, getDisplayNameRTF, getErrorMessage, getFullPathName, getFullPathNameIn, getGUID, getHyperLinks, getIconFileName, getInterfaceName, getIsExternal, getIsOfMetaClass, getIsShowDisplayName, getIsUnresolved, getLocalTags, getMainDiagram, getMetaClass, getName, getNestedElements, getNestedElementsByMetaClass, getNestedElementsRecursive, getNewTermStereotype, getOfTemplate, getOSLCLinks, getOverlayIconFileName, getOverriddenProperties, getOverriddenPropertiesByPattern, getOwnedDependencies, getOwner, getProject, getPropertyValue, getPropertyValueConditional, getPropertyValueConditionalExplicit, getPropertyValueExplicit, getRedefines, getReferences, getRemoteDependencies, getRemoteURI, getRequirementTraceabilityHandle, getSaveUnit, getStereotype, getStereotypes, getTag, getTemplateParameters, getTi, getToolTipHTML, getUserDefinedMetaClass, hasNestedElements, hasPanelWidget, highLightElement, isATemplate, isDescriptionRTF, isDisplayNameRTF, isModified, isRemote, locateInBrowser, lockOnDesignManager, openFeaturesDialog, removeProperty, removeRedefines, removeStereotype, setDecorationStyle, setDescription, setDescriptionAndHyperlinks, setDescriptionHTML, setDescriptionRTF, setDisplayName, setDisplayNameRTF, setGUID, setIsShowDisplayName, setMainDiagram, setName, setOfTemplate, setOwner, setPropertyValue, setRequirementTraceabilityHandle, setStereotype, setTagContextValue, setTagElementValue, setTagValue, setTi, synchronizeTemplateInstantiation, unlockOnDesignManager
 

Method Detail

addActivityFinal

IRPState addActivityFinal()
Adds an ActivityFinal element to an Activity. This method should be called on the root state of the diagram, which you can get by calling IRPStatechart.getRootState().

Returns:
the ActivityFinal element that was created

addConnector

IRPConnector addConnector(java.lang.String type)
Adds a connector element of the specified type to the state.

Parameters:
type - the type of connector that should be added - the valid values for this parameter are: Condition, Fork, History, Join, Termination, InPin, OutPin, InOutPin
Returns:
the connector element that was created

addInternalTransition

IRPTransition addInternalTransition(IRPInterfaceItem trigger)
method addInternalTransition

Throws:
RhapsodyRuntimeException

addState

IRPState addState(java.lang.String name)
Adds a new substate to this state. If you want to add a new top-level state to your statechart, you can call this method on the root state of the statechart, which you can get by calling IRPStatechart.getRootState().

Parameters:
name - the name to use for the new state
Returns:
the state created

addStaticReaction

IRPTransition addStaticReaction(IRPInterfaceItem trigger)
Adds an internal transition to the state.

Parameters:
trigger - the trigger to use for the internal transition
Returns:
the internal transition that was created

addTerminationState

IRPState addTerminationState()
Adds a termination state to a statechart. This method should be called on the root state of the statechart, which you can get by calling IRPStatechart.getRootState().

Returns:
the termination state that was created

createDefaultTransition

IRPTransition createDefaultTransition(IRPState from)
Creates a default transition within the state.

Parameters:
from - the substate that the default transition should lead to
Returns:
the default transition that was created

createNestedStatechart

IRPStatechart createNestedStatechart()
Creates a sub-statechart for the state.

Returns:
the sub-statechart created

deleteConnector

void deleteConnector(IRPConnector connector)
Deletes the specified connector element.

Parameters:
connector - the connector element that should be deleted

deleteInternalTransition

void deleteInternalTransition(IRPTransition pVal)
method deleteInternalTransition

Throws:
RhapsodyRuntimeException

deleteStaticReaction

void deleteStaticReaction(IRPTransition pVal)
Deletes the specified internal transition.

Parameters:
pVal - the internal transition that should be deleted

getDefaultTransition

IRPTransition getDefaultTransition()
Returns the default transition within the state.

Returns:
the default transition within the state

getEntryAction

java.lang.String getEntryAction()
Returns the entry action that was defined for the state.

Returns:
the entry action that was defined for the state

getExitAction

java.lang.String getExitAction()
Returns the exit action that was defined for the state.

Returns:
the exit action that was defined for the state

getFullNameInStatechart

java.lang.String getFullNameInStatechart()
Returns the full name of the state within the statechart, including information about its hierarchical position within the statechart. For example, if your statechart includes a state called Listening within a top-level state called On, the full name would be ROOT.On.Listening.

Returns:
the full name of the state within the statechart

getInheritsFrom

IRPState getInheritsFrom()
Returns the corresponding state from the statechart of the class that this class is derived from.

Returns:
the corresponding state from the statechart of the class that this class is derived from

getInternalTransitions

IRPCollection getInternalTransitions()
Returns a collection of the state's internal transitions.

Returns:
the state's internal transitions
 IRPStatechart cameraStatechart = cameraClass.addStatechart();
 IRPEvent trig_for_internal = cameraPackage.addEvent("trigger_internal");
 IRPEvent trig_for_internal2 = cameraPackage.addEvent("trigger_internal2");
 IRPState stateOne = cameraStatechart.getRootState().addState("state_one");
 stateOne.addInternalTransition(trig_for_internal);
 stateOne.addInternalTransition(trig_for_internal2);
 // now, get and print out the state's internal transitions
 IRPCollection allInternalTransitions = stateOne.getInternalTransitions();
 IRPTransition currentTransition;
 int numberOfInternalTransitions = allInternalTransitions.getCount();
 for(int i = 1; i < numberOfInternalTransitions+1 ; i++) {
 	currentTransition = (IRPTransition)allInternalTransitions.getItem(i);
 	System.out.println(currentTransition.getDisplayName());
 }
 
 

getIsOverridden

int getIsOverridden()
Checks whether there is still an inheritance relationship between this state and the corresponding state from the statechart of the class that this class is derived from.

Returns:
1 if the inheritance relationship is overridden, 0 if there is an inheritance relationship

getIsReferenceActivity

int getIsReferenceActivity()
Checks whether this element is a call behavior element. Note that the Rhapsody API does not provide a method to change an existing IRPState element to a call behavior element. The only way to create a call behavior element is to call the method IRPFlowchart.addCallBehavior or IRPFlowchart.addReferenceActivity.

Returns:
1 if the element is a call behavior element, 0 if it is not

getItsStatechart

IRPStatechart getItsStatechart()
Returns the statechart that this state belongs to.

Returns:
the statechart that this state belongs to

getItsSwimlane

IRPSwimlane getItsSwimlane()
Returns the swimlane that the action is located in.

Returns:
the swimlane that the action is located in

getLogicalStates

IRPCollection getLogicalStates()
Returns a collection of all the substates of the current state and all the first-level substates of those states, meaning down to the second level.

Returns:
a collection of all the substates of the current state and all the first-level substates of those states

getNestedStatechart

IRPStatechart getNestedStatechart()
Returns the state's sub-statechart.

Returns:
the state's sub-statechart

getReferenceToActivity

IRPModelElement getReferenceToActivity()
For call behavior elements, returns the activity that is referenced.

Returns:
the activity that is referenced

getSendAction

IRPSendAction getSendAction()
Returns the Send Action element associated with the state. In the context of the API, a Send Action element is an object of type IRPState for which the state type was set to "EventState" using the setStateType method. In order to manipulate a Send Action element, for example, to set the event for the Send Action, you must first get the Second Action element using the method getSendAction.

Returns:
the Send Action element associated with the state
 IRPState sendActionState = testfc.getRootState().addState("send_action");
 sendActionState.setStateType("EventState");
 IRPSendAction sendActionElement = sendActionState.getSendAction();
 IRPEvent eventA = cameraPackage.addEvent("event_A");
 sendActionElement.setEvent(eventA);
 
 

getStateType

java.lang.String getStateType()
Returns the type of the state, for example, an And state or a Termination state. For the full list of state types, see the documentation for the operation setStateType.

Returns:
the state's type

getStaticReactions

IRPCollection getStaticReactions()
Returns a collection of the state's internal transitions.

Returns:
the state's internal transitions

getSubStateVertices

IRPCollection getSubStateVertices()
Returns a collection of all the first-level elements contained in this state - this includes both node elements and connector elements. The method does not return elements nested within these first-level elements.

Returns:
a collection of all the first-level elements contained in this state

getSubStates

IRPCollection getSubStates()
Returns a collection of the substates contained in this state. Note that this will not work if a state contains a sub-statechart. In such a case, you would have to use code that resembles the following:
 
 IRPState parentState = (IRPState)currentProject.findNestedElementRecursive("busy", "State");
 IRPState topLevelStateInSubchart = (IRPState)(parentState.getNestedStatechart().getRootState().getSubStates().getItem(1));
 IRPCollection substates = topLevelStateInSubchart.getSubStates();
 

Returns:
the substates contained in this state (collection of IRPState objects)

getTheEntryAction

IRPAction getTheEntryAction()
method getTheEntryAction

Throws:
RhapsodyRuntimeException

getTheExitAction

IRPAction getTheExitAction()
method getTheExitAction

Throws:
RhapsodyRuntimeException

isAnd

int isAnd()
Checks whether the state contains one or more And Lines.

Returns:
1 if the state contains one or more And Lines, 0 otherwise.

isCompound

int isCompound()
Checks whether the state is a compound state, meaning a state that contains one or more substates.

Returns:
1 if the state is a compound state, 0 otherwise

isLeaf

int isLeaf()
Checks whether the state is a leaf state, meaning a state that does not contain any substates.

Returns:
1 if the state is a leaf state, 0 if the state contains one or more substates.

isRoot

int isRoot()
Checks whether the state is the root state of the statechart.

Returns:
1 if the state is the root state of the statechart, 0 otherwise

isSendActionState

int isSendActionState()
Checks whether the state is a Send Action element.

Returns:
1 if it is a Send Action element, 0 otherwise

overrideInheritance

void overrideInheritance()
Breaks the inheritance relationship between this state and the corresponding state from the statechart of the class that this class is derived from.


resetEntryActionInheritance

IRPState resetEntryActionInheritance()
Restores the inheritance relationship between this state and the corresponding state from the statechart of the class that this class is derived from, for the entry action.

Returns:
the state on which the method was called (sic)

resetExitActionInheritance

IRPState resetExitActionInheritance()
Restores the inheritance relationship between this state and the corresponding state from the statechart of the class that this class is derived from, for the exit action.

Returns:
the state on which the method was called (sic)

setEntryAction

void setEntryAction(java.lang.String entryAction)
Sets the entry action for the state.

Parameters:
entryAction - the code to use for the state's entry action

setExitAction

void setExitAction(java.lang.String exitAction)
Sets the exit action for the state.

Parameters:
exitAction - the code to use for the state's exit action

setInternalTransition

void setInternalTransition(java.lang.String trigVal,
                           java.lang.String guardVal,
                           java.lang.String actionVal)
method setInternalTransition

Throws:
RhapsodyRuntimeException

setItsSwimlane

void setItsSwimlane(IRPSwimlane itsSwimlane)
Specifies the swimlane that the action should be in

Parameters:
itsSwimlane - the swimlane that the action should be in

setReferenceToActivity

void setReferenceToActivity(IRPModelElement referenceToActivity)
For call behavior elements, sets the activity that is referenced by the element.

Parameters:
referenceToActivity - the activity that should be referenced by the call behavior element

setStateType

void setStateType(java.lang.String stateType)
Specifies the type of the state

Parameters:
stateType - the type of the state. The valid strings for this parameter are: "And", "Or" (for a state that is not an "And" state), "LocalTermination" (for Termination State), "Block" (for Action Block), "Action", "SubActivity", "EventState" (for Send Action), and "FlowFinal"

setStaticReaction

void setStaticReaction(java.lang.String trigVal,
                       java.lang.String guardVal,
                       java.lang.String actionVal)
Adds a new internal transition to the state.

Parameters:
trigVal - the trigger to set for the internal transition
guardVal - the guard to set for the internal transition
actionVal - the action to set for the internal transition

unoverrideInheritance

void unoverrideInheritance()
Restores the inheritance relationship between this state and the corresponding state from the statechart of the class that this class is derived from. This method is used to restore the relationship that was severed with the method overrideInheritance().