|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--fi.utu.cs.physics.Particle
A fundamental particle. The particle can be owned by
an instance of the class Universe
. The particle's
elasticity is used in collisions. The particle can be either corporeal
or ethereal, which determines whether it can collide or not (i.e., only
the corporeal particles can collide). However, the particle
can report on collisions (whether they are corporeal or not) through
the owning Universe
object.
Universe
Constructor Summary | |
protected |
Particle()
Constructs a particle that is corporeal, does not report on collisions and has no owner. |
Method Summary | |
void |
addCollisionNotification(java.lang.Class c)
Adds the class c to the collision notifications. |
void |
clearCollisionNotifications()
Removes all collision notifications. |
abstract void |
elasticCollision(Body other)
Realizes an elastic collision for the particle and the body other . |
Universe |
getOwner()
Returns the owner of the particle or null if
it has no owner. |
abstract void |
inelasticCollision(Body other)
Realizes an inelastic collision for the particle and the body other . |
boolean |
isCollisionNotified(java.lang.Class c)
Returns whether the collisions of and to this particle by instances of the class c are notified.
|
boolean |
isCollisionNotified(Particle p)
Returns whether the collisions of and to this particle by the particle p are notified.
|
boolean |
isCorporeal()
Returns true if the particle is corporeal or
false if the particle is ethereal. |
void |
removeCollisionNotification(java.lang.Class c)
Removes the class c from the collision notifications. |
void |
setCorporeal()
Sets the particle to be corporeal. |
void |
setEthereal()
Sets the particle to be ethereal. |
void |
setOwner(Universe u)
Sets the universe that owns the particle to u . |
java.lang.String |
toString()
Returns a string that contains the values of the attributes. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
protected Particle()
Method Detail |
public Universe getOwner()
null
if
it has no owner.
public void setOwner(Universe u)
u
.
public boolean isCorporeal()
true
if the particle is corporeal or
false
if the particle is ethereal.
public void setCorporeal()
public void setEthereal()
public boolean isCollisionNotified(java.lang.Class c)
c
are notified.
Although only corporeal particles can have an actual
impact in a collision, ethereal particles can report on
collisions.
addCollisionNotification(Class)
,
Universe.CollisionNotification
public boolean isCollisionNotified(Particle p)
p
are notified.
Although only corporeal particles can have an actual impact
in a collision, ethereal particles can report on collisions.
public void addCollisionNotification(java.lang.Class c)
c
to the collision notifications.
public void removeCollisionNotification(java.lang.Class c)
c
from the collision notifications.
public void clearCollisionNotifications()
public abstract void elasticCollision(Body other)
other
. The linear momentum and kinetic
energy are conserved in the collision.
The collision is realized regardless whether the body overlaps or
crosses the particle or not.
inelasticCollision(Body)
public abstract void inelasticCollision(Body other)
other
. The linear momentum and kinetic
energy are lost in the collision. After the collision, the
particle and the body are at rest (i.e., the velocity and acceleration
are zero).
The collision is realized regardless whether the body overlaps or
crosses the particle or not.
elasticCollision(Body)
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |