public abstract class Simulator<T extends DecStatement>
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
class |
Simulator.SimulationSnapshot
The snapshot of simulation.
|
Modifier and Type | Field and Description |
---|---|
protected HashMapMemory |
innerVariablesMemory |
protected HashMapMemory |
outputsMemory |
protected T |
simulatedModel |
Modifier | Constructor and Description |
---|---|
protected |
Simulator(T simulatedModel)
Constructs a simulator for the specified model.
|
Modifier and Type | Method and Description |
---|---|
abstract TestCoverage |
getCoverage()
Returns a test coverage achieved by this simulator since the last reset (if any).
|
abstract State |
getCurrentState()
Returns a state of an underlying model which this simulator is currently in.
|
java.util.Set<java.lang.String> |
getInnerVariableNames()
Returns a collection of inner variables' names.
|
java.util.Set<java.lang.String> |
getOutputVariableNames()
Returns a collection of output variables' names.
|
protected Vector |
getOutputVector()
Returns output vector that is produced by this object.
|
abstract T |
getSimulatedModel()
Returns a model which is simulated by this simulator.
|
ru.ispras.fortress.expression.NodeValue |
getVariableValue(java.lang.String variableName)
Returns value of variable with the specified name.
|
protected boolean |
hasInnerVariable(java.lang.String variableName)
Checks rather this operates with inner variable that has the specified name.
|
protected boolean |
hasInput(java.lang.String variableName)
Checks rather this operates with input variable that has the specified name.
|
protected boolean |
hasOutput(java.lang.String variableName)
Checks rather this operates with output variable that has the specified name.
|
protected void |
loadSnapshot(Simulator.SimulationSnapshot snapshot)
Restores a simulation state from the specified snapshot.
|
Simulator.SimulationSnapshot |
makeSimulationSnapshot()
Returns a snapshot representing a current state of the simulation.
|
protected void |
readVector(Vector vector) |
protected void |
reset()
Resets this simulator, that is, returns it at the same state as it had immediately after
construction.
|
abstract void |
resetCoverage()
Resets a test coverage achieved by this simulator.
|
abstract Sequence |
simulateSequence(Sequence inputSequence)
Simulates processing of the specified input vector and returns produced output vector.
|
abstract Vector |
simulateVector(Vector inputVector)
Simulates processing of the specified input vector and returns produced output vector.
|
protected ru.ispras.fortress.expression.Node |
substituteVariables(ru.ispras.fortress.expression.Node expression,
java.util.Map<java.lang.String,ru.ispras.fortress.expression.NodeValue> bufferedVariables) |
protected final T extends DecStatement simulatedModel
protected HashMapMemory innerVariablesMemory
protected HashMapMemory outputsMemory
protected Simulator(T simulatedModel)
simulatedModel
- the simulated modelpublic abstract T getSimulatedModel()
public abstract Vector simulateVector(Vector inputVector)
inputVector
- the vector to be processedjava.lang.IllegalArgumentException
- if inputVector
is null
public abstract Sequence simulateSequence(Sequence inputSequence)
inputSequence
- the vector to be processedjava.lang.IllegalArgumentException
- if inputSequence
is null
protected void reset()
public abstract TestCoverage getCoverage()
public abstract void resetCoverage()
public abstract State getCurrentState()
protected ru.ispras.fortress.expression.Node substituteVariables(ru.ispras.fortress.expression.Node expression, java.util.Map<java.lang.String,ru.ispras.fortress.expression.NodeValue> bufferedVariables)
protected void readVector(Vector vector)
protected Vector getOutputVector()
public java.util.Set<java.lang.String> getInnerVariableNames()
public java.util.Set<java.lang.String> getOutputVariableNames()
protected boolean hasInput(java.lang.String variableName)
variableName
- Input variable's name.true
when it operates with input variable
that has the specified name, false
otherwise.protected boolean hasInnerVariable(java.lang.String variableName)
variableName
- Inner variable's name.true
when it operates with inner variable
that has the specified name, false
otherwise.protected boolean hasOutput(java.lang.String variableName)
variableName
- Output variable's name.true
when it operates with output variable
that has the specified name, false
otherwise.public ru.ispras.fortress.expression.NodeValue getVariableValue(java.lang.String variableName)
variableName
- variable namenull
otherwisepublic Simulator.SimulationSnapshot makeSimulationSnapshot()
protected void loadSnapshot(Simulator.SimulationSnapshot snapshot)
snapshot
- the snapshot