Class World

java.lang.Object
  |
  +--World
All Implemented Interfaces:
java.lang.Cloneable

public class World
extends java.lang.Object
implements java.lang.Cloneable

One state of the world. Wrapper around a map, gets rid of some annoying casts.


Constructor Summary
World()
           
 
Method Summary
 java.lang.Object clone()
          Clone world.
 Body get(int id)
          Get a body by id.
 java.util.Collection getBodies()
           
 java.util.Map getBodiesById()
           
 java.util.Set getIds()
           
 boolean has(int id)
          Whether world contains body with given id.
 boolean isEmpty()
           
 void put(Body m)
          Place new body into the world, or replace a stale one by id.
 void remove(int id)
          Remove a body by id.
 int size()
           
 java.util.ArrayList snapshotBodies()
           
 void update(long time)
          Extrapolate all moving bodies to given time.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

World

public World()
Method Detail

put

public void put(Body m)
Place new body into the world, or replace a stale one by id.

remove

public void remove(int id)
Remove a body by id.

has

public boolean has(int id)
Whether world contains body with given id.

get

public Body get(int id)
Get a body by id.

isEmpty

public boolean isEmpty()

size

public int size()

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Clone world. Makes shallow copy of map.
Overrides:
clone in class java.lang.Object

getBodiesById

public java.util.Map getBodiesById()

getIds

public java.util.Set getIds()

getBodies

public java.util.Collection getBodies()

snapshotBodies

public java.util.ArrayList snapshotBodies()

update

public void update(long time)
Extrapolate all moving bodies to given time.