gizmoball.testing
Class PinballWorldState

java.lang.Object
  extended by gizmoball.testing.PinballWorldState
All Implemented Interfaces:
WorldState

public class PinballWorldState
extends java.lang.Object
implements WorldState

A pinball game.


Constructor Summary
PinballWorldState()
           
 
Method Summary
 void addGameObject(GameObject g)
          Adds a GameObject to the current set of objects in the world, and adds it to balls or gizmos, as appropriate
 java.util.List<GameObject> getAllGameObjects()
          Returns the set of all game objects in the world at the moment.
 java.util.Map<GameObject,java.util.Map<GameObject,java.util.List<Trigger>>> getAllTriggerInfo()
           
 java.util.List<Ball> getBalls()
          Returns the set of all balls that are in the world.
 java.util.List<Gizmo> getGizmos()
          Returns the set of all gizmos in the world.
 java.util.List<Trigger> getTriggers(GameObject g)
          Returns the set of all triggers that are activated when a certain GameObject is triggered.
 void removeGameObject(GameObject g)
          Removes a GameObject from the current set of objects in the world, also removing it from balls or gizmos, as appropriate
 void update(GameObject oldObject, GameObject newObject)
          Replaces the old object with the new object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PinballWorldState

public PinballWorldState()
Method Detail

addGameObject

public void addGameObject(GameObject g)
Description copied from interface: WorldState
Adds a GameObject to the current set of objects in the world, and adds it to balls or gizmos, as appropriate

Specified by:
addGameObject in interface WorldState

getAllGameObjects

public java.util.List<GameObject> getAllGameObjects()
Description copied from interface: WorldState
Returns the set of all game objects in the world at the moment. This list will be immutable.

Specified by:
getAllGameObjects in interface WorldState
Returns:
all game objects (including balls and gizmos). If there are no objects, returns the empty list.

getAllTriggerInfo

public java.util.Map<GameObject,java.util.Map<GameObject,java.util.List<Trigger>>> getAllTriggerInfo()

getBalls

public java.util.List<Ball> getBalls()
Description copied from interface: WorldState
Returns the set of all balls that are in the world. This list will be immutable.

Specified by:
getBalls in interface WorldState
Returns:
all balls in the world. If there are no balls, returns the empty list.

getGizmos

public java.util.List<Gizmo> getGizmos()
Description copied from interface: WorldState
Returns the set of all gizmos in the world. This list will be immutable.

Specified by:
getGizmos in interface WorldState
Returns:
all gizmos in the world. If there are no gizmos, returns the empty list.

getTriggers

public java.util.List<Trigger> getTriggers(GameObject g)
Description copied from interface: WorldState
Returns the set of all triggers that are activated when a certain GameObject is triggered. This list will be immutable.

Specified by:
getTriggers in interface WorldState
Returns:
the triggers corresponding to a GameObject. If there are no triggers, returns an empty list.

removeGameObject

public void removeGameObject(GameObject g)
Description copied from interface: WorldState
Removes a GameObject from the current set of objects in the world, also removing it from balls or gizmos, as appropriate

Specified by:
removeGameObject in interface WorldState

update

public void update(GameObject oldObject,
                   GameObject newObject)
Description copied from interface: WorldState
Replaces the old object with the new object. If you get the old object, make a copy, make some changes, and want to put those changes back into the WorldState, this is how you do it. One important thing, is: pre(getTriggers(oldObject)) = post(getTriggers(newObject))

Specified by:
update in interface WorldState