public class SimulationRun
extends java.lang.Object
implements java.io.Serializable
SimulationRun
is basically a sequence of
SimulationState
s, but should rather be seen as a database
with routines for manipulation. Thus, it is some kind of "simulation
service".
Listed functions:
SimulationRun
s to disc
Modifier and Type | Field and Description |
---|---|
static SimulationRun |
simulationRun |
Modifier and Type | Method and Description |
---|---|
void |
addExplosionParticle(Vector position,
Vector speed,
double creationTime) |
void |
addScanFan(double key,
ScanFan value) |
void |
addSmokeParticle(Vector position,
Vector speed,
double creationTime) |
void |
addSonarTrace(double key,
SonarTrace value) |
SimulationRun |
anonymizedClone()
Also called zombification.
|
void |
appendState(SimulationState state)
This method appends a state at the end of this list.
|
void |
cropAfter(int index)
This method removes all states after the state specified by
index . |
java.util.TreeMap<java.lang.Double,AbstractPilot> |
getGraveyard() |
int |
getLastStateBefore(double timestamp)
Returns the index of the
SimulationState with the highest
timestamp that is equal or smaller than the specified
timestamp . |
SimulationState |
getSimulationState(int index)
Returns the
SimulationState with the specified index. |
int |
getStateCount()
Returns the number of
SimulationState s currently stored
in this SimulationRun . |
java.util.TreeMap<java.lang.Double,Angle> |
getTurret(int index) |
java.util.TreeMap<java.lang.Double,Body> |
getWasteDump() |
public static SimulationRun simulationRun
public void addExplosionParticle(Vector position, Vector speed, double creationTime)
public void addScanFan(double key, ScanFan value)
public void addSmokeParticle(Vector position, Vector speed, double creationTime)
position
- speed
- creationTime
- public void addSonarTrace(double key, SonarTrace value)
public SimulationRun anonymizedClone() throws java.io.IOException, java.lang.ClassNotFoundException
Does a full copy of this SimulationRun.
Exchanges all Pilot implementations with PilotZombies.
All internal data is stripped off from the pilots.
Take them their thoughts but leave their decisions.
That has the following effects:
java.io.IOException
- Any exception thrown by the underlying OutputStream.NotSerializableException
- Some object to be serialized does not implement the java.io.Serializable interface.java.lang.ClassNotFoundException
- Something is wrong with a class used by serialization.public void appendState(SimulationState state)
state
- the state to be appendedpublic void cropAfter(int index)
index
.index
- the last state that should be retainedpublic java.util.TreeMap<java.lang.Double,AbstractPilot> getGraveyard()
public int getLastStateBefore(double timestamp)
SimulationState
with the highest
timestamp that is equal or smaller than the specified
timestamp
.timestamp
- public SimulationState getSimulationState(int index)
SimulationState
with the specified index.index
- the index of the desired statepublic int getStateCount()
SimulationState
s currently stored
in this SimulationRun
.SimulationState
s currently stored
in this SimulationRun
public java.util.TreeMap<java.lang.Double,Angle> getTurret(int index)
public java.util.TreeMap<java.lang.Double,Body> getWasteDump()