|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.gicentre.utils.network.traer.physics.AbstractForce
org.gicentre.utils.network.traer.physics.TargetedForce
org.gicentre.utils.network.traer.physics.TwoBodyForce
public abstract class TwoBodyForce
TwoBodyForce is Force
between two specified Particle
s, which extends
TargetedForce
and simplifies implementation of custom Forces. A TwoBodyForce deals
with all of the mechanics of getting at the two "ends" of Force and reduces the details of
what a user needs to specify down to creating the force Vector3D
s that act on the
ends. If the forces are of the standard equal-and-opposite variety, only the force on one
end needs to be provided.
Nested Class Summary | |
---|---|
protected static class |
TwoBodyForce.ForcePair
Class that wraps Vector3D forces to apply to the two ends of this TwoBodyForce. |
Constructor Summary | |
---|---|
protected |
TwoBodyForce(Particle oneEnd,
Particle theOtherEnd)
Creates a two-body force between the two given particles. |
Method Summary | |
---|---|
TwoBodyForce |
apply()
Applies this Force to oneEnd and theOtherEnd , which modifies their
Particle.force values. |
protected static TwoBodyForce.ForcePair |
equalAndOpposite(Vector3D forceOnOneEnd)
Creates a force pair for when the forces to be applied are equal and opposite. |
protected abstract TwoBodyForce.ForcePair |
forcePair()
Should apply the force to the pair of particles. |
Particle |
getOneEnd()
Reports the particle at oneEnd . |
Particle |
getTheOtherEnd()
Reports the particle at theOtherEnd . |
protected TwoBodyForce |
setOneEnd(Particle p)
Sets oneEnd to the give particle. |
protected TwoBodyForce |
setTheOtherEnd(Particle p)
Sets theOtherEnd to the give particle. |
protected static TwoBodyForce.ForcePair |
specifyBoth(Vector3D forceOnOneEnd,
Vector3D forceOnTheOtherEnd)
Creates a TwoBodyForce.ForcePair from two not necessarily equal and opposite forces. |
TwoBodyForce |
turnOff()
Turns this force off. |
TwoBodyForce |
turnOn()
Turns this force on. |
TwoBodyForce |
turnOn(boolean isOn)
Turns this force on or off. |
Methods inherited from class org.gicentre.utils.network.traer.physics.TargetedForce |
---|
apply |
Methods inherited from class org.gicentre.utils.network.traer.physics.AbstractForce |
---|
isOff, isOn |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected TwoBodyForce(Particle oneEnd, Particle theOtherEnd) throws java.lang.NullPointerException
Particle
is mutated by this operation, though later use of the apply()
method will mutate the Particle.force
vector.
oneEnd
- the one end Particle
, cannot be nulltheOtherEnd
- the other end Particle
, cannot be null
java.lang.NullPointerException
- if either Particle
is null
.Method Detail |
---|
public final Particle getOneEnd()
oneEnd
. Mutating this Particle
is permitted.
oneEnd
public final Particle getTheOtherEnd()
theOtherEnd
. Mutating this Particle
is permitted.
theOtherEnd
public TwoBodyForce apply()
oneEnd
and theOtherEnd
, which modifies their
Particle.force
values.
forcePair()
,
taking advantage of the static packaging method equalAndOpposite(Vector3D)
or
specifyBoth(Vector3D, Vector3D)
to create the TwoBodyForce.ForcePair
.
public TwoBodyForce turnOff()
turnOff
in interface Force
turnOff
in class AbstractForce
public TwoBodyForce turnOn()
turnOn
in interface Force
turnOn
in class AbstractForce
public TwoBodyForce turnOn(boolean isOn)
turnOn
in interface Force
turnOn
in class AbstractForce
isOn
- This force is turned on if true, otherwise it is turned off.
protected TwoBodyForce setOneEnd(Particle p) throws java.lang.NullPointerException
oneEnd
to the give particle.
p
- The particle at one end of this Force; cannot be null
java.lang.NullPointerException
- if the particle is null
.protected TwoBodyForce setTheOtherEnd(Particle p) throws java.lang.NullPointerException
theOtherEnd
to the give particle.
p
- The particle at the other end of this Force; cannot be null
java.lang.NullPointerException
- if the particle is null
.protected static TwoBodyForce.ForcePair specifyBoth(Vector3D forceOnOneEnd, Vector3D forceOnTheOtherEnd) throws java.lang.NullPointerException
TwoBodyForce.ForcePair
from two not necessarily equal and opposite forces.
forceOnOneEnd
- the force to be applied to oneEnd
forceOnTheOtherEnd
- the force to be applied to theOtherEnd
java.lang.NullPointerException
- if either Vector3D
==null
protected static TwoBodyForce.ForcePair equalAndOpposite(Vector3D forceOnOneEnd) throws java.lang.NullPointerException
forceOnOneEnd
- the force on oneEnd
java.lang.NullPointerException
- if forceOnOneEnd is nullprotected abstract TwoBodyForce.ForcePair forcePair()
TwoBodyForce.ForcePair
are provided within this class: equalAndOpposite(Vector3D)
or specifyBoth(Vector3D, Vector3D)
.
TwoBodyForce.ForcePair
specifying the forces to apply to oneEnd
and theOtherEnd
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |