RobotCore 1.0
WPILib port to raspberry Pi
Loading...
Searching...
No Matches
org.wpilib.units.UnaryFunction Interface Reference

Public Member Functions

double apply (double input)
default UnaryFunction pipeTo (UnaryFunction next)
default UnaryFunction mult (UnaryFunction multiplier)
default UnaryFunction mult (double multiplier)
default UnaryFunction div (UnaryFunction divisor)
default UnaryFunction div (double divisor)
default UnaryFunction exp (UnaryFunction exponent)
default UnaryFunction exp (double exponent)

Public Attributes

UnaryFunction IDENTITY = x -> x

Detailed Description

A function that accepts a single double and returns a double result. This is used to represent arbitrary mapping functions for converting units to and from a base unit representation. Temperature units, in particular, typically have an offset from a value in Kelvin and may have a multiplication factor added in, which means that units cannot always be represented as simple ratios of their base units.

Definition at line 17 of file UnaryFunction.java.

Member Function Documentation

◆ apply()

double org.wpilib.units.UnaryFunction.apply ( double input)

Applies this function to the input value and returns the result.

Parameters
inputthe input value to the function
Returns
the result

◆ div() [1/2]

default UnaryFunction org.wpilib.units.UnaryFunction.div ( double divisor)

Creates a composite function h(x) such that h(x) = 1/k * f(x).

Parameters
divisorthe constant value to divide this function's results by
Returns
the composite function 1/k * f(x)

Definition at line 100 of file UnaryFunction.java.

◆ div() [2/2]

default UnaryFunction org.wpilib.units.UnaryFunction.div ( UnaryFunction divisor)

Creates a composite function h(x) such that h(x) = f(x) / g(x).

Parameters
divisorthe function to divide this one by
Returns
the composite function f(x) / g(x)

Definition at line 77 of file UnaryFunction.java.

◆ exp() [1/2]

default UnaryFunction org.wpilib.units.UnaryFunction.exp ( double exponent)

Creates a composite function h(x) such that h(x) = f(x) ^ k.

Parameters
exponentthe constant value to exponentiate this function's results by
Returns
the composite function f(x) ^ k

Definition at line 122 of file UnaryFunction.java.

◆ exp() [2/2]

default UnaryFunction org.wpilib.units.UnaryFunction.exp ( UnaryFunction exponent)

Creates a composite function h(x) such that h(x) = f(x) ^ g(x).

Parameters
exponentthe function to exponentiate this function's results by
Returns
the composite function f(x) ^ g(x)

Definition at line 110 of file UnaryFunction.java.

◆ mult() [1/2]

default UnaryFunction org.wpilib.units.UnaryFunction.mult ( double multiplier)

Creates a composite function h(x) such that h(x) = k * f(x).

Parameters
multiplierthe constant value to multiply this function's results by
Returns
the composite function k * f(x)

Definition at line 67 of file UnaryFunction.java.

◆ mult() [2/2]

default UnaryFunction org.wpilib.units.UnaryFunction.mult ( UnaryFunction multiplier)

Creates a composite function h(x) such that h(x) = f(x) * g(x).

Parameters
multiplierthe function to multiply this one by
Returns
the composite function f(x) * g(x)

Definition at line 55 of file UnaryFunction.java.

◆ pipeTo()

default UnaryFunction org.wpilib.units.UnaryFunction.pipeTo ( UnaryFunction next)

Constructs a new function that first calls this function, then passes the result to another as input.

f = x -> x + 1 // f(x) = x + 1
g = x -> 2 * x // g(x) = 2x

h = f.pipeTo(g) // h(x) = g(f(x))
Parameters
nextthe next operation to pipe to
Returns
the composite function g(f(x))

Definition at line 43 of file UnaryFunction.java.

Member Data Documentation

◆ IDENTITY

UnaryFunction org.wpilib.units.UnaryFunction.IDENTITY = x -> x

The identity function that simply returns the input value.

Definition at line 19 of file UnaryFunction.java.


The documentation for this interface was generated from the following file: