public final class EfsmUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.util.Collection<EfsmTransition> |
getIncoming(Efsm efsm,
EfsmState state)
Returns transitions of the specified EFSM that end at the specified state.
|
static java.util.Collection<EfsmTransition> |
getOutgoing(Efsm efsm,
EfsmState state)
Returns transitions of the specified EFSM that start at the specified state.
|
static java.util.Map<ru.ispras.fortress.expression.NodeVariable,java.util.Set<ru.ispras.fortress.expression.NodeVariable>> |
getResultingDependencies(Action action)
Returns mapping between modified variables and affecting variables.
|
static java.util.Map<ru.ispras.fortress.expression.NodeVariable,ru.ispras.fortress.expression.Node> |
getResultingSubstitutions(Action action)
Returns mapping between variables and corresponding substitutions.
|
static java.util.List<EfsmTransition> |
getShortestPath(Efsm efsm,
EfsmState sourceState,
EfsmState destinationState,
Efsm.TransitionWeightBasis weightBasis)
Looks for the shortest path at the specified EFSM from the specified source state
to the specified destination state with the specified principle of transition
weight defining.
|
static java.util.Collection<ru.ispras.fortress.expression.NodeVariable> |
getStateVariables(Efsm efsm)
Returns state-like variables for the specified EFSM.
|
static boolean |
hasDeclaringAncestor(Efsm efsm,
ru.ispras.fortress.expression.NodeVariable variable)
Checks whether the specified EFSM (or it's ancestor) declares the specified variable.
|
static boolean |
isInputDeclared(Efsm efsm,
java.lang.String variableName)
Checks if the specified input is declared either in the EFSM or in it's parent module.
|
static boolean |
isOutputDeclared(Efsm efsm,
java.lang.String variableName)
Checks if the specified output is declared either in the EFSM or in it's parent module.
|
static boolean |
isReachable(Efsm efsm,
EfsmState sourceState,
EfsmState destinationState)
Checks if there is a path from the specified source state to the specified destination state
at the specified EFSM..
|
static boolean |
isRegisterDeclared(Efsm efsm,
java.lang.String variableName)
Checks if the specified register declared either in the EFSM or in it's parent module.
|
static Efsm |
product(Efsm... efsms)
Constructs a synchronous composition from a list of EFSMs.
|
public static boolean isInputDeclared(Efsm efsm, java.lang.String variableName)
efsm
- The EFSM to be checked.variableName
- The name of input variable.true
if the input is declared. Otherwise returns false
.public static boolean isOutputDeclared(Efsm efsm, java.lang.String variableName)
efsm
- The EFSM to be checked.variableName
- The name of output variable.true
if the output is declared. Otherwise returns false
.public static boolean isRegisterDeclared(Efsm efsm, java.lang.String variableName)
efsm
- The EFSM to be checked.variableName
- The name of register variable.true
if the register is declared. Otherwise returns false
.public static boolean isReachable(Efsm efsm, EfsmState sourceState, EfsmState destinationState)
efsm
- The EFSM to be checked.sourceState
- The source state.destinationState
- The destination state.true
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 static java.util.Collection<EfsmTransition> getIncoming(Efsm efsm, EfsmState state)
efsm
- The EFSM that contains the specified state.state
- The state of the specified EFSM.java.lang.IllegalArgumentException
- if the specified state is not found in this EFSMpublic static java.util.Collection<EfsmTransition> getOutgoing(Efsm efsm, EfsmState state)
efsm
- The EFSM that contains the specified state.state
- The state of the specified EFSM.java.lang.IllegalArgumentException
- if the specified state is not found in this EFSMpublic static java.util.Collection<ru.ispras.fortress.expression.NodeVariable> getStateVariables(Efsm efsm)
efsm
- The EFSM that state-like variables are returned.public static java.util.Map<ru.ispras.fortress.expression.NodeVariable,java.util.Set<ru.ispras.fortress.expression.NodeVariable>> getResultingDependencies(Action action)
Returns mappings between modified variables and variables which affects corresponding modifications.
For example, if this action consists of two subsequent assignments x = y
and
z = x + i
, the resulting map contains mappings from x
to y
and from
z
to y
and i
.
public static java.util.Map<ru.ispras.fortress.expression.NodeVariable,ru.ispras.fortress.expression.Node> getResultingSubstitutions(Action action)
Returns mappings between variables and corresponding substitutions representing total variable modifications during execution of this action. That is, execution of this action is equal to parallel evaluation of the substitutions and subsequent assignment of derived values to the corresponding variables.
public static Efsm product(Efsm... efsms)
efsms
- the list of EFSMsjava.lang.IllegalArgumentException
- if the specified list of EFSMs is null
or contains less than two modelspublic static boolean hasDeclaringAncestor(Efsm efsm, ru.ispras.fortress.expression.NodeVariable variable)
efsm
- EFSM to be checked if it (or it's ancestor) declares variablevariable
- variable to be checked for declarationtrue
if the specified EFSM (or some it's ancestor) declares the specified
variable, false
otherwisepublic static java.util.List<EfsmTransition> getShortestPath(Efsm efsm, EfsmState sourceState, EfsmState destinationState, Efsm.TransitionWeightBasis weightBasis)
efsm
- the EFSMsourceState
- 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 passed.