org.gicentre.utils.network.traer.physics

## Class AbstractForce

- java.lang.Object
- - org.gicentre.utils.network.traer.physics.AbstractForce

- All Implemented Interfaces:
    Force
  Direct Known Subclasses:
    TargetedForce, UniversalForce

      public abstract class AbstractForce
      extends java.lang.Object
      implements Force

  A skeletal implementation of `Force` covering the methods concerned with the on/off state. For the typical user wishing to make a custom Force, it is best to extend this class (or one of the other skeletal implementations that meet the custom needs more specifically: `TargetedForce`, `UniversalForce`, or `TwoBodyForce`) and deal only with defining the `Force.apply()` and `Force.apply(Particle)` methods.
  Version:
    3.4, 5th February, 2016.
  Author:
    Carl Pearson, Jeffrey Traer Bernstein with Minor Modifications by Jo Wood.

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractForce()` Creates a default abstract force set to `on`.
    `protected` | `AbstractForce(boolean isOn)` Creates an abstract force with the given state.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `isOff()` Reports whether or not the force is off.
    `boolean` | `isOn()` Reports whether or not the force is on.
    `AbstractForce` | `turnOff()` Turns the force off.
    `AbstractForce` | `turnOn()` Turns the force on.
    `AbstractForce` | `turnOn(boolean isOn)` Sets the force to the given state.

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

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

    - ### Methods inherited from interface org.gicentre.utils.network.traer.physics.Force

      `apply, apply`

- - ### Constructor Detail

    - #### AbstractForce

          protected AbstractForce()

      Creates a default abstract force set to `on`.

    - #### AbstractForce

          protected AbstractForce(boolean isOn)

      Creates an abstract force with the given state.
      Parameters:
        `isOn` - The initial state of the force.

  - ### Method Detail

    - #### turnOff

          public AbstractForce turnOff()

      Turns the force off.
      Specified by:
        `turnOff` in interface `Force`
      Returns:
        This force now in an 'off' state.

    - #### turnOn

          public AbstractForce turnOn()

      Turns the force on.
      Specified by:
        `turnOn` in interface `Force`
      Returns:
        This force now in an 'on' state.

    - #### turnOn

          public AbstractForce turnOn(boolean isOn)

      Sets the force to the given state.
      Specified by:
        `turnOn` in interface `Force`
      Parameters:
        `isOn` - Determins if this force is on or off.
      Returns:
        This force in its newly set state.

    - #### isOn

          public boolean isOn()

      Reports whether or not the force is on.
      Specified by:
        `isOn` in interface `Force`
      Returns:
        True if the force is on.

    - #### isOff

          public boolean isOff()

      Reports whether or not the force is off.
      Specified by:
        `isOff` in interface `Force`
      Returns:
        True if the force is off.