public class Efsm extends VariableContainer
Modifier and Type | Class and Description |
---|---|
static class |
Efsm.TransitionWeightBasis |
Modifier and Type | Field and Description |
---|---|
static EfsmState |
UNINIT_STATE
An object representing a state based on uninitialised values.
|
NEW_VAR_PREFIX
Constructor and Description |
---|
Efsm(EfsmModule parent,
java.lang.String name)
Constructs an empty EFSM with the specified name and parent module.
|
Modifier and Type | Method and Description |
---|---|
void |
addClock(ru.ispras.fortress.expression.NodeVariable clockVariable)
Add the specified object as clock-like variable for this model.
|
void |
addResetGuardedAction(GuardedAction resetGuardedAction)
Adds the specified guarded action to this EFSM.
|
void |
addState(EfsmState state)
Adds the specified state into this EFSM.
|
boolean |
containsState(EfsmState state)
Checks if the specified state is in this EFSM.
|
boolean |
containsStates()
Checks if this EFSM contains states or not.
|
EfsmState |
createState(ru.ispras.fortress.expression.Node expression)
Creates a new state based on the specified logical expression and adds it into this EFSM.
|
EfsmTransition |
createTransition(EfsmState sourceState,
EfsmState destinationState,
GuardedAction guardedAction)
Creates a new transition with the specified guarded action between the specified states and
adds it into this EFSM.
|
boolean |
equals(java.lang.Object object) |
java.util.Collection<ru.ispras.fortress.expression.NodeVariable> |
getClocks()
Returns clock-like variables related to this model.
|
ru.ispras.fortress.data.DataType |
getDataType(java.lang.String variableName)
Returns data type of the declared variable with the specified name.
|
java.util.Set<EfsmState> |
getDestinationStates(EfsmState state)
Returns states which are end points of outgoing transitions of the specified state.
|
java.util.Set<EfsmTransition> |
getIncomingTransitions(EfsmState state)
Returns transitions which ends at the specified state.
|
EfsmState |
getInitialState()
Returns an initial state of this EFSM.
|
ru.ispras.fortress.expression.Node |
getInitialValue(java.lang.String variableName)
Returns initial value of the declared variable with the specified name.
|
ru.ispras.fortress.expression.Node |
getInvariant(java.lang.String variableName)
Returns invariant of the declared variable with the specified name.
|
java.lang.String |
getName()
Returns a name of this EFSM.
|
java.util.Set<EfsmTransition> |
getOutgoingTransitions(EfsmState state)
Returns transitions which starts at the specified state.
|
EfsmModule |
getParentContainer()
Returns parent container of this EFSM.
|
java.util.Set<GuardedAction> |
getResetGuardedActions()
Returns reset guarded actions of this EFSM, that is, such guarded actions which represent an
initialisation of this EFSM.
|
java.util.List<EfsmTransition> |
getShortestPath(EfsmState sourceState,
EfsmState destinationState,
Efsm.TransitionWeightBasis weightBasis)
Looks for the shortest path from the specified source state to the specified destination state
with the specified principle of transition weight defining.
|
java.util.Set<EfsmState> |
getSourceStates(EfsmState state)
Returns states which are start points of incoming transitions of the specified state.
|
java.util.Set<EfsmState> |
getStates()
Returns all states of this EFSM.
|
java.util.Set<EfsmTransition> |
getTransitions()
Returns all transitions of this EFSM.
|
int |
hashCode() |
boolean |
isInputDeclared(java.lang.String variableName)
Checks if the specified input declared either in this EFSM or in its parent module.
|
boolean |
isOutputDeclared(java.lang.String variableName)
Checks if the specified output declared either in this EFSM or in its parent module.
|
boolean |
isReachable(EfsmState sourceState,
EfsmState destinationState)
Checks if there is a path from the specified source state to the specified destination state.
|
boolean |
isRegisterDeclared(java.lang.String variableName)
Checks if the specified register declared either in this EFSM or in its parent module.
|
boolean |
isSynchronous()
Checks if this EFSM is synchronous, that is, contains at least one event-sensible guarded
action.
|
void |
setInitialState(EfsmState state)
Marks the specified state of this EFSM as an initial state.
|
java.lang.String |
toString() |
containsInput, containsOutput, containsRegister, containsVariable, containsVariable, declareVariable, declareVariable, declareVariable, declareVariables, getBindings, getDeclaration, getDeclarations, getInputNames, getOutputNames, getRegisterNames, getVariable, getVariables, setBindings
addMetaInfo, addMetaInfo, addMetaInfo, addMetaInfo, getMetaInfo, getMetaInfo, getMetaInfo, hasMetaInfo, hasMetaInfo, removeMetaInfo
public static final EfsmState UNINIT_STATE
public Efsm(EfsmModule parent, java.lang.String name)
parent
- the module which contains the constructed EFSMname
- the EFSM namejava.lang.IllegalArgumentException
- if either parent
or name
is null
public EfsmModule getParentContainer()
public boolean isInputDeclared(java.lang.String variableName)
variableName
- a name of the inputtrue
if the input is declared. Otherwise returns false
.public boolean isOutputDeclared(java.lang.String variableName)
variableName
- a name of the outputtrue
if the output is declared. Otherwise returns false
.public boolean isRegisterDeclared(java.lang.String variableName)
variableName
- a name of the registertrue
if the register is declared. Otherwise returns false
.public ru.ispras.fortress.data.DataType getDataType(java.lang.String variableName)
VariableContainer
getDataType
in class VariableContainer
variableName
- variable namenull
otherwise.public ru.ispras.fortress.expression.Node getInitialValue(java.lang.String variableName)
VariableContainer
getInitialValue
in class VariableContainer
variableName
- variable namenull
otherwise.public ru.ispras.fortress.expression.Node getInvariant(java.lang.String variableName)
VariableContainer
getInvariant
in class VariableContainer
variableName
- variable namenull
otherwise.public EfsmState createState(ru.ispras.fortress.expression.Node expression)
expression
- the expression representing the statejava.lang.IllegalArgumentException
- if at least one variable which is in the expression is not
declared neither in this EFSM nor in its parentpublic void addState(EfsmState state)
state
- the state to be addedjava.lang.NullPointerException
- if state
is null
java.lang.IllegalArgumentException
- if at least one variable which is in the expression is not
declared neither in this EFSM nor in its parentjava.lang.IllegalArgumentException
- when argument is null
public EfsmTransition createTransition(EfsmState sourceState, EfsmState destinationState, GuardedAction guardedAction)
sourceState
- a source statedestinationState
- a destination stateguardedAction
- the guarded actionjava.lang.IllegalArgumentException
- if the specified source and/or destination state is not found
in this EFSM or at least one variable which is in guardedAction
is not
declared neither in this EFSM nor in its parentpublic java.lang.String getName()
public boolean containsState(EfsmState state)
state
- the state whose presence in the EFSM to be testedtrue
if this EFSM contains the specified state. Otherwise returns false
public void setInitialState(EfsmState state)
state
- the new initial state of this EFSMjava.lang.IllegalArgumentException
- if the specified state is not found in this EFSMpublic EfsmState getInitialState()
public void addResetGuardedAction(GuardedAction resetGuardedAction)
resetGuardedAction
- the reset guarded actionjava.lang.IllegalArgumentException
- if the resetGuardedAction
is null
public java.util.Set<GuardedAction> getResetGuardedActions()
public void addClock(ru.ispras.fortress.expression.NodeVariable clockVariable)
When the specified variable is used in a guard of some resetting transition, this method does nothing, because a variable cannot be placed both at clocks and resets.
clockVariable
- clock-like variablejava.lang.IllegalArgumentException
- when argument is null
.public java.util.Collection<ru.ispras.fortress.expression.NodeVariable> getClocks()
public java.util.Set<EfsmState> getStates()
public java.util.Set<EfsmTransition> getTransitions()
public boolean isSynchronous()
true
if this EFSM is synchronous. Otherwise returns false
public boolean isReachable(EfsmState sourceState, EfsmState destinationState)
sourceState
- the source statedestinationState
- the destination statetrue
if there is a path from the source state to the destination state.
Otherwise returns false
java.lang.IllegalArgumentException
- if the specified source and/or destination state is not found
in this EFSMpublic java.util.List<EfsmTransition> getShortestPath(EfsmState sourceState, EfsmState destinationState, Efsm.TransitionWeightBasis weightBasis)
sourceState
- the source statedestinationState
- the destination stateweightBasis
- the principle used for transition weight computingnull
is returnedjava.lang.IllegalArgumentException
- if the specified source and/or destination state is not found
in this EFSM or if unsupported Efsm.TransitionWeightBasis
is passedpublic java.util.Set<EfsmTransition> getIncomingTransitions(EfsmState state)
state
- the state to be testedjava.lang.IllegalArgumentException
- if the specified state is not found in this EFSMpublic java.util.Set<EfsmTransition> getOutgoingTransitions(EfsmState state)
state
- the state to be testedjava.lang.IllegalArgumentException
- if the specified state is not found in this EFSMpublic java.util.Set<EfsmState> getSourceStates(EfsmState state)
state
- the state to be testedjava.lang.IllegalArgumentException
- if the specified state is not found in this EFSMpublic java.util.Set<EfsmState> getDestinationStates(EfsmState state)
state
- the state to be testedjava.lang.IllegalArgumentException
- if the specified state is not found in this EFSMpublic boolean containsStates()
true
if this EFSM contains states, false
otherwisepublic int hashCode()
hashCode
in class VariableContainer
public boolean equals(java.lang.Object object)
equals
in class VariableContainer
public java.lang.String toString()
toString
in class java.lang.Object