org.gicentre.utils.network.traer.physics

## Class TwoBodyForce.ForcePair

- java.lang.Object
- - org.gicentre.utils.network.traer.physics.TwoBodyForce.ForcePair

- Enclosing class:
    TwoBodyForce

      protected static class TwoBodyForce.ForcePair
      extends java.lang.Object

  Class that wraps Vector3D forces to apply to the two ends of this TwoBodyForce.
  For the especially memory conscious, the ForcePair fields can be manipulated directly; use the `updateBoth(Vector3D, Vector3D)` or `updateEqualAndOpposite(Vector3D)` or use the getters and manipulate the Vector3Ds directly.
  Author:
    Carl Pearson

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected Vector3D` | `forceOnOneEnd()` Reports the force at oneEnd.
    `protected Vector3D` | `forceOnTheOtherEnd()` Reports the force at theOtherEnd.
    `protected TwoBodyForce.ForcePair` | `updateBoth(Vector3D forceOnOneEnd, Vector3D forceOnTheOtherEnd)` Updates the force for both ends according to the parameters.
    `protected TwoBodyForce.ForcePair` | `updateEqualAndOpposite(Vector3D forceOnOneEnd)` Sets the force at oneEnd according to forceOnOneEnd argument, and the force on theOtherEnd as equal and opposite.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### forceOnOneEnd

          protected Vector3D forceOnOneEnd()

      Reports the force at oneEnd.
      Returns:
        the force at oneEnd

    - #### forceOnTheOtherEnd

          protected Vector3D forceOnTheOtherEnd()

      Reports the force at theOtherEnd. Changing this Vector3D will not mutate the forceOnOneEnd, even in the equal-and-opposite case.
      Returns:
        the force at theOtherEnd

    - #### updateEqualAndOpposite

          protected TwoBodyForce.ForcePair updateEqualAndOpposite(Vector3D forceOnOneEnd)
                                                           throws java.lang.NullPointerException,
                                                                  java.lang.IllegalStateException

      Sets the force at oneEnd according to forceOnOneEnd argument, and the force on theOtherEnd as equal and opposite.
      Parameters:
        `forceOnOneEnd` - the force on oneEnd
      Returns:
        this ForcePair, modified
      Throws:
        `java.lang.NullPointerException` - if forceOnOneEnd is null
        `java.lang.IllegalStateException`

    - #### updateBoth

          protected TwoBodyForce.ForcePair updateBoth(Vector3D forceOnOneEnd,
                                                      Vector3D forceOnTheOtherEnd)
                                               throws java.lang.NullPointerException

      Updates the force for both ends according to the parameters.
      Parameters:
        `forceOnOneEnd` - the force on oneEnd Particle
        `forceOnTheOtherEnd` - the force on theOtherEnd Particle
      Returns:
        this ForcePair, modified
      Throws:
        `java.lang.NullPointerException` - if either argument is null