|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--fi.utu.cs.physics.Universe.CollisionNotification
Comprises a Body object and a Particle
object that have been the counterparts in a collision. The
Universe class, which is inherited from
Observable, submits an instance of this class to
its observers. The notification is sent if and only if
(1) a body and a particle collide, and (2) either the body or
the particle wants its collisions to be notified.
Particle.addCollisionNotification(Class),
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 |
|
Universe.CollisionNotification(Body b,
Particle p)
Creates a notification for the body b
and the particle p |
|
| Method Summary | |
int |
counterpart(java.lang.Class t)
Returns which of the counterparts is of the type t. |
Body |
getBody()
Returns the body involved in the collision. |
Body |
getCounterpart(int i)
Deprecated. As of version 1.1, replaced by getParticle(int). |
Particle |
getParticle()
Returns the particle involved in the collision. |
Particle |
getParticle(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 |
public static final int NONE
public static final int FIRST
Body.
public static final int SECOND
Particle.
public static final int BOTH
| Constructor Detail |
public Universe.CollisionNotification(Body b1,
Body b2)
b1
and b2
public Universe.CollisionNotification(Body b,
Particle p)
b
and the particle p
| Method Detail |
public Body getCounterpart(int i)
getParticle(int).
ith counterpart of the collision.
Note: Throws a ClassCastException if
i == SECOND and the second counterpart is not an
instance of the class Body.
public Body getBody()
public Particle getParticle()
public Particle getParticle(int i)
ith counterpart of the collision.
Returns null, if i != FIRST and
i != SECOND.
FIRST,
SECONDpublic int counterpart(java.lang.Class t)
t.
NONE,
FIRST,
SECOND,
BOTH
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||