com.threerings.tudey.util
Class ActorHistory

java.lang.Object
  extended by com.threerings.tudey.util.ActorHistory

public class ActorHistory
extends Object

Records a sequence of actor states and allows finding the interpolated historical state.


Nested Class Summary
protected static class ActorHistory.Entry
          A single historical entry.
 
Field Summary
protected  int _duration
          The amount of time to retain entries.
protected  ArrayList<ActorHistory.Entry> _entries
          The stored list of entries.
 
Constructor Summary
ActorHistory(int timestamp, Actor actor, int duration)
          Creates a new history with the provided initial time and state.
 
Method Summary
 Actor get(int timestamp, Actor result)
          Finds the state at the specified timestamp and places it into the result object.
 void init(int timestamp, Actor actor)
          (Re)initializes the history.
 boolean isCreated(int timestamp)
          Determines whether the actor has yet been created at the specified timestamp.
 boolean isDestroyed(int timestamp)
          Determines whether the actor has been destroyed at the specified timestamp.
 void record(int timestamp, Actor actor)
          Records a state in the stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_duration

protected int _duration
The amount of time to retain entries.


_entries

protected ArrayList<ActorHistory.Entry> _entries
The stored list of entries.

Constructor Detail

ActorHistory

public ActorHistory(int timestamp,
                    Actor actor,
                    int duration)
Creates a new history with the provided initial time and state.

Method Detail

init

public void init(int timestamp,
                 Actor actor)
(Re)initializes the history.


record

public void record(int timestamp,
                   Actor actor)
Records a state in the stream.


isCreated

public boolean isCreated(int timestamp)
Determines whether the actor has yet been created at the specified timestamp.


isDestroyed

public boolean isDestroyed(int timestamp)
Determines whether the actor has been destroyed at the specified timestamp.


get

public Actor get(int timestamp,
                 Actor result)
Finds the state at the specified timestamp and places it into the result object.