In the source code for the function classes in the SlingFunction hierarchy, the design principles show through. They are as follows:
Represent each known function with a class that implements the method f().
Write f() for each function class so that it wraps its function around other function objects. Require that these objects be supplied to the class constructor.
Define the signature of f() to be Point f(double t).
For any base function that would naturally return a single number y, return new Point(t, y), where t is the input parameter to f().
The classes in this hierarchy also provide the ability to create unvariable functions from variable functions by evaluating their sources. The Variable class and the hierarchy superclass ...