|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object SynchronousStateQueue
public class SynchronousStateQueue
Allows global state snapshots to be passed between threads, thus giving safe communication between graphics and simulation components
Constructor Summary | |
---|---|
SynchronousStateQueue()
|
Method Summary | |
---|---|
double |
addState(double[] arrLfPositions,
StateBundle[] arrStates,
IAgent agent,
double lfTime,
CommGraph graph)
push another simulated state onto the queue, return the difference in (simulation) time between the last frame requested by the drawing engine and the last frame pushed on by the simulator graph must be copied before calling this. |
double |
addStateIfEmpty(double[] arrLfPositions,
StateBundle[] arrStates,
IAgent agent,
double lfTime,
CommGraph graph)
push another simulated state onto the queue, but only if the queue is empty return the difference in (simulation) time between the last frame requested by the drawing engine and the last frame pushed on by the simulator graph must be copied before calling this. |
SwarmState |
getLeastRecent(SwarmState lclCache)
gets a copy of the least recent state in the queue, returns lclCache if the timestamp of lclCache matches that of the least recent state. |
int |
removeBefore(double lfTime)
removes all elements on the queue corresonding to times less then lfTime, unless doing so empties queue, in which case it leaves the last element. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SynchronousStateQueue()
Method Detail |
---|
public SwarmState getLeastRecent(SwarmState lclCache)
lclCache
- to prevent excessive copying should this be
called multiple times, anything passed as "lclCache" should
only be touched by one thread.
public int removeBefore(double lfTime)
lfTime
- remove all elements before this time (except for
last element in the queue)
public double addState(double[] arrLfPositions, StateBundle[] arrStates, IAgent agent, double lfTime, CommGraph graph)
public double addStateIfEmpty(double[] arrLfPositions, StateBundle[] arrStates, IAgent agent, double lfTime, CommGraph graph)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |