org.gicentre.utils.network.traer.physics

## Class Function<From,To>

- java.lang.Object
- - org.gicentre.utils.network.traer.physics.Function<From,To>

- Type Parameters:
    `From` - Source for transform function.
    `To` - Result of transform function.
  Direct Known Subclasses:
    Drag, Gravity

      public abstract class Function<From,To>
      extends java.lang.Object

  Abstraction of functions capable of performing iterated transformations.
  Version:
    3.4, 5th February, 2016.
  Author:
    Carl Pearson with minor modifications by Jo Wood.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Function()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract To` | `apply(From from)` Should apply the function on the given From value.
    `<ToNew> Function<From,ToNew>` | `combine(Function<To,ToNew> otherFunction)` Combines the given function with this one.
    `static <From,To> void` | `functor(java.lang.Iterable<From> source, Function<From,To> sideEffector)` Applies the given sideEffector on the the source.
    `static <To,From> java.lang.Iterable<To>` | `transform(java.lang.Iterable<From> source, Function<From,To> transform)` Transforms the given source using the given function.

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

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

- - ### Constructor Detail

    - #### Function

          public Function()

  - ### Method Detail

    - #### apply

          public abstract To apply(From from)

      Should apply the function on the given From value.
      Parameters:
        `from` - From class upon which to apply the function.
      Returns:
        The transformed value.

    - #### functor

          public static <From,To> void functor(java.lang.Iterable<From> source,
                                               Function<From,To> sideEffector)

      Applies the given sideEffector on the the source.
      Type Parameters:
        `From` - From type
        `To` - To Type
      Parameters:
        `source` - Source upon which to apply the given sideEffector.
        `sideEffector` - SideEffector to apply to the given data.

    - #### transform

          public static <To,From> java.lang.Iterable<To> transform(java.lang.Iterable<From> source,
                                                                   Function<From,To> transform)

      Transforms the given source using the given function.
      Type Parameters:
        `To` - To type.
        `From` - From type.
      Parameters:
        `source` - Source upon which to apply.
        `transform` - Function to perform the transformation
      Returns:
        An iterable view of the the transformed data.

    - #### combine

          public <ToNew> Function<From,ToNew> combine(Function<To,ToNew> otherFunction)

      Combines the given function with this one.
      Type Parameters:
        `ToNew` - The new type.
      Parameters:
        `otherFunction` - Other function to combine with this one.
      Returns:
        Combined function.