public final class Efsm extends ModuleProcess
Modifier and Type | Class and Description |
---|---|
static class |
Efsm.TransitionWeightBasis
Transition weight types.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
STATE_NOT_FOUND
A string prefix for "state not found" error message.
|
static EfsmState |
UNINIT_STATE
An object representing a state based on uninitialised values.
|
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 rstGuardedAction)
Adds the specified guarded action to this EFSM.
|
void |
addState(EfsmState state)
Adds the specified state into this EFSM.
|
EfsmState |
addState(ru.ispras.fortress.expression.Node expression)
Creates a new state based on the specified logical expression and adds it into this EFSM.
|
void |
addTransition(EfsmState src,
EfsmState dst,
GuardedAction guardedAction)
Creates a new transition with the specified guarded action between the specified states and
adds it into this EFSM.
|
boolean |
containsState(EfsmState state)
Checks if the specified state is in this EFSM.
|
Efsm |
deepCopy()
Returns a deep copy of the 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<ru.ispras.fortress.expression.NodeVariable> |
getDefines()
Returns a set of defined variables.
|
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.
|
EfsmModule |
getParentContainer()
Returns parent container of this EFSM.
|
java.util.List<GuardedAction> |
getResetGuardedActions()
Returns reset guarded actions of this EFSM, that is, such guarded actions which represent an
initialisation of this EFSM.
|
int |
getStateNum()
Returns the number of states for this EFSM.
|
java.util.Collection<EfsmState> |
getStates()
Returns all states of this EFSM.
|
java.util.Set<ru.ispras.fortress.expression.NodeVariable> |
getStateVariables()
Returns the set of state variables that are used in this object.
|
int |
getTransitionNum()
Returns the number of transitions for this EFSM.
|
java.util.Collection<EfsmTransition> |
getTransitions()
Returns all transitions of this EFSM.
|
java.util.Set<ru.ispras.fortress.expression.NodeVariable> |
getUses()
Returns a set of used variables.
|
boolean |
hasInitState()
Checks rather this object has non-
null initial state. |
void |
remove(EfsmState state)
Removes the specified state from this EFSM object.
|
void |
remove(EfsmTransition transition)
Removes the specified transition from this object.
|
void |
setInitialState(EfsmState state)
Marks the specified state of this EFSM as an initial state.
|
void |
setSingleTestable(boolean singleTestable)
Make the object to be non or single testable depending on the value of the specified parameter.
|
boolean |
singleTestable()
Checks whether this object can be tested as single one, or not.
|
java.lang.String |
toString() |
addEvent, clearEvents, getDescription, getEventList, getName, getType, isInitial, isSequential, setEventList, setParent
declareNewVariable, declares, declares, declaresInput, declaresOutput, declaresRegister, declareVariable, declareVariable, declareVariable, declareVariable, declareVariables, getDeclaration, getDeclarationMap, getDeclarations, getInputNames, getInputs, getOutputNames, getOutputs, getRegisterNames, getVariable, getVariableNames, getVariables, removeDeclaration
add, add, addAll, apply, contains, containStatements, equals, getDescription, getId, getParent, getStatement, getStatementNum, hashCode, indexOf, isType, remove, removeAll, removeParent
addMetaInfo, addMetaInfo, addMetaInfo, getMetaInfo, getMetaInfo, hasMetaInfo, hasMetaInfo
public static final EfsmState UNINIT_STATE
public static final java.lang.String STATE_NOT_FOUND
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 Efsm deepCopy()
public boolean singleTestable()
If the object is single testable, it means, that it can be run in an isolated environment. Either it does not have any dependencies from other EFSM objects, or they're negligible.
true
if this object can be tested as a single one,
false
otherwise.public void setSingleTestable(boolean singleTestable)
singleTestable
- The single testability flag.public EfsmModule getParentContainer()
public EfsmState addState(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 parentjava.lang.IllegalArgumentException
- when argument is null
.public void addState(EfsmState state)
Do nothing when the specified state is already added to this object.
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 java.util.Set<ru.ispras.fortress.expression.NodeVariable> getStateVariables()
public void addTransition(EfsmState src, EfsmState dst, GuardedAction guardedAction)
src
- a source statedst
- 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 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 rstGuardedAction)
rstGuardedAction
- the reset guarded actionjava.lang.IllegalArgumentException
- if the resetGuardedAction
is null
public java.util.List<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.Collection<EfsmState> getStates()
public int getStateNum()
public void remove(EfsmState state)
state
- State to ber removed.java.lang.IllegalArgumentException
- when argument is null
.public void remove(EfsmTransition transition)
transition
- Transition to be removed from this object.java.lang.IllegalArgumentException
- when argument is null
.public java.util.Collection<EfsmTransition> getTransitions()
public int getTransitionNum()
public boolean hasInitState()
null
initial state.true
if this object contains initial state, false
otherwise.public ru.ispras.fortress.data.DataType getDataType(java.lang.String variableName)
DecStatement
getDataType
in class DecStatement
variableName
- variable namenull
otherwise.public ru.ispras.fortress.expression.Node getInitialValue(java.lang.String variableName)
DecStatement
getInitialValue
in class DecStatement
variableName
- variable namenull
otherwise.public ru.ispras.fortress.expression.Node getInvariant(java.lang.String variableName)
DecStatement
getInvariant
in class DecStatement
variableName
- variable namenull
otherwise.public java.util.Set<ru.ispras.fortress.expression.NodeVariable> getUses()
UseDef
public java.util.Set<ru.ispras.fortress.expression.NodeVariable> getDefines()
UseDef
getDefines
in interface UseDef
getDefines
in class Statement
public java.lang.String toString()
toString
in class java.lang.Object