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.
|
java.util.Set<ru.ispras.fortress.expression.NodeVariable> |
getDefines() |
java.util.Collection<EfsmTransition> |
getIncoming(EfsmState state)
Returns transitions of the EFSM that end at the specified state.
|
int |
getInCount(EfsmState state)
Returns the number of incoming transitions for the specified state.
|
EfsmState |
getInitialState()
Returns an initial state of this EFSM.
|
int |
getOutCount(EfsmState state)
Returns the number of outgoing transitions for the specified state.
|
java.util.Collection<EfsmTransition> |
getOutgoing(EfsmState state)
Returns transitions of the EFSM that start at the specified state.
|
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.
|
java.util.List<EfsmTransition> |
getShortestPath(EfsmState src,
EfsmState dst,
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.
|
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() |
boolean |
hasInitState()
Checks rather this object has non-
null initial state. |
boolean |
isReachable(EfsmState sourceState,
EfsmState destinationState)
Checks if there is a path from the specified source state to the specified destination state
at the model.
|
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, addProperty, clearEvents, getDescription, getEventList, getName, getProperties, getType, hasEvent, isInitial, isSequential, setEventList, setParent
add, add, addAll, apply, contains, containStatements, equals, getDescription, getId, getParent, getStatement, getStatementNum, hashCode, indexOf, isType, remove, removeAll, removeParent
addMetaInfo, addMetaInfo, addMetaInfo, addMetaInfo, getAllMetaInfo, getMetaInfo, getMetaInfo, getStringMetaInfo, getStringMetaInfo, 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 int getInCount(EfsmState state)
state
- The model state.public int getOutCount(EfsmState state)
state
- The model state.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 boolean isReachable(EfsmState sourceState, EfsmState destinationState)
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 java.util.Collection<EfsmTransition> getIncoming(EfsmState state)
state
- The model state.java.lang.IllegalArgumentException
- if the specified state is not found in this EFSMpublic java.util.Collection<EfsmTransition> getOutgoing(EfsmState state)
state
- The model state.java.lang.IllegalArgumentException
- if the specified state is not found in this EFSMpublic java.util.List<EfsmTransition> getShortestPath(EfsmState src, EfsmState dst, Efsm.TransitionWeightBasis weightBasis)
src
- the source statedst
- 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.public java.util.Set<ru.ispras.fortress.expression.NodeVariable> getUses()
public java.util.Set<ru.ispras.fortress.expression.NodeVariable> getDefines()
getDefines
in interface ru.ispras.castle.ast.UseDef
getDefines
in class Statement
public java.lang.String toString()
toString
in class java.lang.Object