public abstract class DecoratorSimulator extends java.lang.Object implements ISimulator
Constructor and Description |
---|
DecoratorSimulator(ISimulator decorated)
Creates a new instance based on a decorated instance
|
Modifier and Type | Method and Description |
---|---|
boolean |
alternateStep()
Makes one alternate step of the last one.
|
void |
cleanPreviousConfigurations()
Cleans the configurations previously reached
|
int |
countAlternatives()
Counts the alternative steps which could be taken
|
Configuration |
getCurrentConfig()
Gets the current configuration
|
java.io.PrintStream |
getInfoChannel() |
Psystem |
getPsystem()
Returns the P-system simulated
|
double |
getTime()
Gets the elapsed time since the beginning of the simulation
|
int |
getVerbosity()
Gets the verbosity level which the instances take into account when reporting messages.
|
boolean |
isFinished()
Returns if the simulator has finished
|
boolean |
isTimed()
Gets if the elapsed time is being measured
|
void |
reset()
Resets the simulator to the initial configuration
|
void |
run()
Runs the simulator until reaching a halting configuration
|
void |
runSteps(int steps)
Takes a specified number of steps
|
void |
runUntilTimeOut(long timeOut)
Runs the simulator until the time out has been reached
|
void |
runUntilTimeOutorSteps(long timeOut,
int steps)
Runs the simulator until whether the time out or the steps have been
reached
|
void |
setCurrentConfig(Configuration configuration)
Sets the current configuration of the simulator
|
void |
setInfoChannel(java.io.PrintStream infoChannel)
Sets the simulator info channel
|
void |
setPsystem(Psystem psystem)
Sets the simulator P-system
|
void |
setTimed(boolean time)
Sets if the elapsed time is being measured or not
|
void |
setVerbosity(int verbosity)
Sets the verbosity level which the instances take into account when reporting messages.
|
boolean |
step()
Takes one step of simulation and generate a new configuration
|
boolean |
stepBack()
Takes one step back
|
boolean |
stepsBackAvailable()
Returns a boolean representing if there are any step back which the simulator can go back to
|
void |
stopThread()
Stops the current thread where the run process takes place
|
boolean |
supportsAlternateSteps()
Reports if the simulator supports alternate steps
|
boolean |
supportsStepBack()
Reports if the simulator supports step back
|
public DecoratorSimulator(ISimulator decorated)
decorated
- the simulator to be decorated, as stated by decorator patternpublic void setPsystem(Psystem psystem)
ISimulator
setPsystem
in interface ISimulator
psystem
- the simulator p-systemISimulator.setPsystem(org.gcn.plinguacore.util.psystem.Psystem)
public void cleanPreviousConfigurations()
ISimulator
cleanPreviousConfigurations
in interface ISimulator
ISimulator.cleanPreviousConfigurations()
public void setCurrentConfig(Configuration configuration)
ISimulator
setCurrentConfig
in interface ISimulator
configuration
- the configuration to be setISimulator.setCurrentConfig(org.gcn.plinguacore.util.psystem.Configuration)
public int getVerbosity()
ISimulator
getVerbosity
in interface ISimulator
ISimulator.getVerbosity()
public void setVerbosity(int verbosity)
ISimulator
setVerbosity
in interface ISimulator
verbosity
- the verbosity level to set.ISimulator.setVerbosity(int)
public boolean stepsBackAvailable()
ISimulator
stepsBackAvailable
in interface ISimulator
ISimulator.stepsBackAvailable()
public final void runUntilTimeOut(long timeOut)
ISimulator
runUntilTimeOut
in interface ISimulator
timeOut
- the time out set as the maximum time outorg.gcn.plinguacore.simulator.ISimulator#runUntilTimeOut(int)
public final void run() throws PlinguaCoreException
ISimulator
run
in interface ISimulator
PlinguaCoreException
- if any exception occurred during the executionISimulator.run()
public final void runSteps(int steps) throws PlinguaCoreException
ISimulator
runSteps
in interface ISimulator
steps
- the steps to be takenPlinguaCoreException
- if any exception occurred during the executionISimulator.runSteps(int)
public boolean alternateStep() throws java.lang.UnsupportedOperationException
ISimulator
alternateStep
in interface ISimulator
java.lang.UnsupportedOperationException
- if alternate steps are not supportedISimulator.alternateStep()
public int countAlternatives() throws java.lang.UnsupportedOperationException
ISimulator
countAlternatives
in interface ISimulator
java.lang.UnsupportedOperationException
- if alternate steps are not supportedISimulator.countAlternatives()
public boolean supportsStepBack()
ISimulator
supportsStepBack
in interface ISimulator
ISimulator.supportsStepBack()
public boolean supportsAlternateSteps()
ISimulator
supportsAlternateSteps
in interface ISimulator
ISimulator.supportsAlternateSteps()
public final Configuration getCurrentConfig()
ISimulator
getCurrentConfig
in interface ISimulator
ISimulator.getCurrentConfig()
public final java.io.PrintStream getInfoChannel()
getInfoChannel
in interface ISimulator
ISimulator.getInfoChannel()
public final double getTime()
ISimulator
getTime
in interface ISimulator
ISimulator.getTime()
public final boolean isTimed()
ISimulator
isTimed
in interface ISimulator
ISimulator.isTimed()
public void reset()
ISimulator
reset
in interface ISimulator
ISimulator.reset()
public Psystem getPsystem()
ISimulator
getPsystem
in interface ISimulator
ISimulator.getPsystem()
public void setInfoChannel(java.io.PrintStream infoChannel)
ISimulator
setInfoChannel
in interface ISimulator
infoChannel
- the info channel to be setISimulator.setInfoChannel(java.io.PrintStream)
public void setTimed(boolean time)
ISimulator
setTimed
in interface ISimulator
time
- if the elapsed time is being measuredISimulator.setTimed(boolean)
public boolean step() throws PlinguaCoreException
ISimulator
step
in interface ISimulator
PlinguaCoreException
- if a semantic error occursISimulator.step()
public void runUntilTimeOutorSteps(long timeOut, int steps)
ISimulator
runUntilTimeOutorSteps
in interface ISimulator
timeOut
- the maximum time out allowedsteps
- the maximum steps allowedorg.gcn.plinguacore.simulator.ISimulator#runUntilTimeOutorSteps(int, int)
public boolean stepBack()
ISimulator
stepBack
in interface ISimulator
ISimulator.stepBack()
public void stopThread()
ISimulator
stopThread
in interface ISimulator
ISimulator.stopThread()
public boolean isFinished()
ISimulator
isFinished
in interface ISimulator
ISimulator.isFinished()