fi.utu.cs.physics
Class Universe.CollisionNotification

java.lang.Object
  |
  +--fi.utu.cs.physics.Universe.CollisionNotification
Enclosing class:
Universe

public class Universe.CollisionNotification
extends java.lang.Object

Comprises two Body objects that have been counterparts in a collision. The Universe class, which is inherited from Observable, submits an instance of this class to its observers whenever two bodies collide.

See Also:
Observable.notifyObservers(Object), Observer.update(Observable,Object)

Field Summary
static int BOTH
          Both of the counterparts.
static int FIRST
          The first counterpart.
static int NONE
          None of the counterparts.
static int SECOND
          The second counterpart.
 
Constructor Summary
Universe.CollisionNotification(Body b1, Body b2)
          Creates a notification for the bodies b1 and b2
 
Method Summary
 int counterpart(java.lang.Class t)
          Returns which of the counterparts is of the type t.
 Body getCounterpart(int i)
          Returns the ith counterpart of the collision.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NONE

public static final int NONE
None of the counterparts.

FIRST

public static final int FIRST
The first counterpart.

SECOND

public static final int SECOND
The second counterpart.

BOTH

public static final int BOTH
Both of the counterparts.
Constructor Detail

Universe.CollisionNotification

public Universe.CollisionNotification(Body b1,
                                      Body b2)
Creates a notification for the bodies b1 and b2
Method Detail

getCounterpart

public Body getCounterpart(int i)
Returns the ith counterpart of the collision.
See Also:
FIRST, SECOND

counterpart

public int counterpart(java.lang.Class t)
Returns which of the counterparts is of the type t.
See Also:
NONE, FIRST, SECOND, BOTH