public class Efsm extends Model
Modifier and Type | Class and Description |
---|---|
static class |
Efsm.TransitionWeightBasis |
Constructor and Description |
---|
Efsm(java.lang.String name)
Constructs an empty EFSM with the specified name.
|
Modifier and Type | Method and Description |
---|---|
void |
addInnerVariable(java.lang.String name,
ru.ispras.fortress.data.DataType type)
Adds a new inner variable with the specified name and type to this model.
|
void |
addInput(java.lang.String name,
ru.ispras.fortress.data.DataType type)
Adds a new input with the specified name and type to this model.
|
void |
addInvariant(java.lang.String name,
ru.ispras.fortress.expression.Node invariant)
Adds the specified invariant condition on the value of the specified variable.
|
void |
addOutput(java.lang.String name,
ru.ispras.fortress.data.DataType type)
Adds a new output with the specified name and type to this model
|
boolean |
addState(EfsmState state)
Adds the specified state to this EFSM.
|
boolean |
containsInnerVariable(java.lang.String name)
Checks if this model has an inner variable with the specified name.
|
boolean |
containsInput(java.lang.String name)
Checks if this model has an input with the specified name.
|
boolean |
containsInvariant(java.lang.String name)
Checks if this EFSM contains an invariant condition on the specified variable.
|
boolean |
containsOutput(java.lang.String name)
Checks if this model has an output with the specified name.
|
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.NodeOperation 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 obj)
Compares the specified object with this EFSM for equality.
|
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.data.DataType |
getInnerDataType(java.lang.String name)
Returns a data type of the specified inner variable of this model.
|
java.util.Map<java.lang.String,ru.ispras.fortress.data.DataType> |
getInnerDataTypes()
Returns data types of all inner variables of this model
|
java.util.Map<java.lang.String,ru.ispras.fortress.data.DataType> |
getInnerDataTypes(java.util.Collection<java.lang.String> names)
Returns data types of the specified inner variables of this model.
|
ru.ispras.fortress.data.DataType |
getInputDataType(java.lang.String name)
Returns a data type of the specified input variable of this model.
|
java.util.Map<java.lang.String,ru.ispras.fortress.data.DataType> |
getInputDataTypes()
Returns data types of all input variables of this model.
|
java.util.Map<java.lang.String,ru.ispras.fortress.data.DataType> |
getInputDataTypes(java.util.Collection<java.lang.String> names)
Returns data types of the specified input variables of this model.
|
ru.ispras.fortress.expression.Node |
getInvariantCondition(ru.ispras.fortress.expression.NodeVariable variable)
Returns an invariant condition which is related to the specified variable.
|
ru.ispras.fortress.expression.Node |
getInvariantCondition(java.lang.String variableName)
Returns an invariant condition which is related to the specified variable.
|
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.
|
ru.ispras.fortress.data.DataType |
getOutputDataType(java.lang.String name)
Returns a data type of the specified output of this model.
|
java.util.Map<java.lang.String,ru.ispras.fortress.data.DataType> |
getOutputDataTypes()
Returns data types of all output signals of this model.
|
java.util.Map<java.lang.String,ru.ispras.fortress.data.DataType> |
getOutputDataTypes(java.util.Collection<java.lang.String> names)
Returns data types of the specified output variables of this model.
|
GuardedAction |
getResetGuardedAction()
Returns a reset guarded action of this EFSM, that is, such a guarded action which represents a
precondition of the initial state and an action which is performed during 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 |
isReachable(EfsmState sourceState,
EfsmState destinationState)
Checks if there is a path from the specified source state to the specified destination state.
|
boolean |
isSynchronous()
Checks if this EFSM is synchronous, that is, contains at least one event-sensible guarded
action.
|
static Efsm |
product(Efsm... efsmList)
Constructs a synchronous composition from a list of EFSMs.
|
void |
setInitialState(EfsmState state)
Marks the specified state of this EFSM as an initial state.
|
void |
setResetGuardedAction(GuardedAction resetGuardedAction)
Adds the specified guarded action to this EFSM.
|
java.lang.String |
toString() |
addMetaInfo, addMetaInfo, addMetaInfo, addMetaInfo, getMetaInfo, getMetaInfo, getMetaInfo, hasMetaInfo, hasMetaInfo, removeMetaInfo, removeMetaInfo
public Efsm(java.lang.String name)
name
- the EFSM namejava.lang.NullPointerException
- if name
is null
public EfsmState createState(ru.ispras.fortress.expression.NodeOperation expression)
expression
- the expression representing the statepublic boolean addState(EfsmState state)
state
- the state to be addedtrue
if state is successfully added, otherwise returns false
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 EFSMpublic ru.ispras.fortress.expression.Node getInvariantCondition(java.lang.String variableName)
variableName
- a name of the variablenull
is returned if there is no condition which is
related to the specified variablegetInvariantCondition(NodeVariable)
public ru.ispras.fortress.expression.Node getInvariantCondition(ru.ispras.fortress.expression.NodeVariable variable)
variable
- the variablenull
is returned if there is no condition which is
related to the specified variablegetInvariantCondition(String)
public 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 addInput(java.lang.String name, ru.ispras.fortress.data.DataType type)
Model
public void addInnerVariable(java.lang.String name, ru.ispras.fortress.data.DataType type)
Model
addInnerVariable
in class Model
name
- the name of the variable to be addedtype
- the type of the variable to be addedpublic void addOutput(java.lang.String name, ru.ispras.fortress.data.DataType type)
Model
public void addInvariant(java.lang.String name, ru.ispras.fortress.expression.Node invariant)
name
- a name of the variableinvariant
- the conditionjava.lang.NullPointerException
- if any of the arguments is null
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()
getInitialState
in class Model
public void setResetGuardedAction(GuardedAction resetGuardedAction)
resetGuardedAction
- the reset guarded actionjava.lang.NullPointerException
- if the resetGuardedAction
is null
public GuardedAction getResetGuardedAction()
public java.util.Set<EfsmState> getStates()
public java.util.Set<EfsmTransition> getTransitions()
public ru.ispras.fortress.data.DataType getInputDataType(java.lang.String name)
Model
getInputDataType
in class Model
name
- a name of the inputpublic java.util.Map<java.lang.String,ru.ispras.fortress.data.DataType> getInputDataTypes(java.util.Collection<java.lang.String> names)
Model
getInputDataTypes
in class Model
names
- a collection containing names of the inputspublic java.util.Map<java.lang.String,ru.ispras.fortress.data.DataType> getInputDataTypes()
Model
getInputDataTypes
in class Model
public ru.ispras.fortress.data.DataType getOutputDataType(java.lang.String name)
Model
getOutputDataType
in class Model
name
- a name of the outputpublic java.util.Map<java.lang.String,ru.ispras.fortress.data.DataType> getOutputDataTypes(java.util.Collection<java.lang.String> names)
Model
getOutputDataTypes
in class Model
names
- a collection containing names of the outputspublic java.util.Map<java.lang.String,ru.ispras.fortress.data.DataType> getOutputDataTypes()
Model
getOutputDataTypes
in class Model
public ru.ispras.fortress.data.DataType getInnerDataType(java.lang.String name)
Model
getInnerDataType
in class Model
name
- a name of the variablepublic java.util.Map<java.lang.String,ru.ispras.fortress.data.DataType> getInnerDataTypes(java.util.Collection<java.lang.String> names) throws java.lang.IllegalArgumentException
Model
getInnerDataTypes
in class Model
names
- a collection containing names of the variablesjava.lang.IllegalArgumentException
- if at least on of the specified variables is not found among
the model inner variablespublic java.util.Map<java.lang.String,ru.ispras.fortress.data.DataType> getInnerDataTypes()
Model
getInnerDataTypes
in class Model
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 containsInput(java.lang.String name)
Model
containsInput
in class Model
name
- the name to be checkedtrue
if this model has the input, otherwise returns false
public boolean containsInnerVariable(java.lang.String name)
Model
containsInnerVariable
in class Model
name
- the name to be checkedtrue
if this model has the inner variable, otherwise returns false
public boolean containsOutput(java.lang.String name)
Model
containsOutput
in class Model
name
- the name to be checkedtrue
if this model has the output, otherwise returns false
public boolean containsInvariant(java.lang.String name)
name
- a name of the variabletrue
if this EFSM contains an invariant on the variable with the specified
name, false
otherwisejava.lang.NullPointerException
- if name
is null
public static Efsm product(Efsm... efsmList)
efsmList
- the list of EFSMsjava.lang.IllegalArgumentException
- if the specified list of EFSMs is null
or contains
less than two modelspublic boolean containsStates()
true
if this EFSM contains states, false
otherwisepublic int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
Efsm
class or its subclass;
equals
in class java.lang.Object
obj
- the object to be compared for equality with this EFSMtrue
if the specified object is equal to this EFSM. Otherwise returns
false
public java.lang.String toString()
toString
in class java.lang.Object