noope.laws
Class ParticlePairLaw
java.lang.Object
|
+--noope.laws.Law
|
+--noope.laws.ParticlePairLaw
- Direct Known Subclasses:
- Gravity, SphereCollision
- public abstract class ParticlePairLaw
- extends Law
This is an abstract subclass of Law used to model a Law that acts on a pair of Entitys,
i.e. the net force exerted on an entity by this law is the sum of the forces exerted on it by
all other entitys. It must be suitable to consider the entitys acted on to be
points of mass.
To create a subclass, you have to override actOnPair(Entity, Entity), possibly
constructNewPropertyRecord and the constructor.
- Version:
- 28 April 2001 Removed ListIterator by Miklos Reiter for compatibility with Java 1.1
- Author:
- Miklos Reiter
Fields inherited from class noope.laws.Law |
physics |
Method Summary |
void |
act()
Apply law to all pairs of entities. |
abstract void |
actOnPair(Entity ent1,
Entity ent2)
Applies the law to the two parameters. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ParticlePairLaw
public ParticlePairLaw(BlockReader br,
int lawnumber,
Physics phys)
throws BRLoadingException
- Just calls the inherited constructor.
act
public void act()
- Apply law to all pairs of entities. It just calls actOnPair(Entity, Entity) on all
pairs of distinct entitys in Entities. If you want to create a subclass to model
a particular law, you should override actOnPair, not act.
- Overrides:
act
in class Law
- Following copied from class:
noope.laws.Law
- Parameters:
e
- the list of entities that the force should act on- See Also:
Entity.addForce(Vector3D)
actOnPair
public abstract void actOnPair(Entity ent1,
Entity ent2)
- Applies the law to the two parameters. This should be overridden in subclasses.