org.gicentre.utils.network.traer.physics
Class Function<From,To>

java.lang.Object
  extended by org.gicentre.utils.network.traer.physics.Function<From,To>
Direct Known Subclasses:
Drag, Gravity

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

Abstraction of functions capable of performing iterated transformations.

Author:
Carl Pearson with minor modifications by Jo Wood.

Constructor Summary
Function()
           
 
Method Summary
abstract  To apply(From from)
          Should apply the function on the given From value.
<ToNew> Function<From,ToNew>
combine(Function<To,ToNew> other)
           
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> other)


giCentre Utilities V.3.3, API documentation generated 6th April, 2013