|
RobotCore 1.0
WPILib port to raspberry Pi
|
Classes | |
| class | MappingBuilder |
| interface | UnitConstructorFunction |
Public Member Functions | |
| UnitBuilder (U base) | |
| UnitBuilder< U > | offset (double offset) |
| MappingBuilder | mappingInputRange (double minBase, double maxBase) |
| UnitBuilder< U > | fromBase (UnaryFunction fromBase) |
| UnitBuilder< U > | toBase (UnaryFunction toBase) |
| UnitBuilder< U > | named (String name) |
| UnitBuilder< U > | symbol (String symbol) |
| UnitBuilder< U > | splitInto (double fraction) |
| UnitBuilder< U > | aggregate (double aggregation) |
| U | make (UnitConstructorFunction< U > constructor) |
| U | make () |
Builder used for easily deriving new units from existing ones. When deriving a new unit, the base unit class must redeclare the constructor (U, UnaryFunction, UnaryFunction, String, String). The unit builder class will invoke this constructor automatically and build the new unit. Alternatively, new units can be derived by passing an explicit constructor function to make(UnitConstructorFunction).
| <U> | the type of the unit |
Definition at line 21 of file UnitBuilder.java.
| org.wpilib.units.UnitBuilder< U extends Unit >.UnitBuilder | ( | U | base | ) |
Creates a new unit builder object, building off of a base unit. The base unit does not have to be the base unit of its unit system; furlongs work just as well here as meters.
| base | the unit to base the new unit off of |
Definition at line 34 of file UnitBuilder.java.
| UnitBuilder< U > org.wpilib.units.UnitBuilder< U extends Unit >.aggregate | ( | double | aggregation | ) |
Helper for defining units that are a scalar multiple of the base unit, such as kilometers being 1000x of the base unit (meters).
| aggregation | the magnitude required for a measure in the base unit to equal a magnitude of 1 in the derived unit |
Definition at line 180 of file UnitBuilder.java.
| UnitBuilder< U > org.wpilib.units.UnitBuilder< U extends Unit >.fromBase | ( | UnaryFunction | fromBase | ) |
Sets the conversion function to transform values in the base unit to values in the derived unit.
| fromBase | the conversion function |
Definition at line 115 of file UnitBuilder.java.
| U org.wpilib.units.UnitBuilder< U extends Unit >.make | ( | ) |
Creates the new unit based off of the builder methods called prior.
| NullPointerException | if the unit conversions, unit name, or unit symbol were not set |
| RuntimeException | if the base unit does not define a constructor accepting the conversion functions, unit name, and unit symbol - in that order |
Definition at line 246 of file UnitBuilder.java.
| U org.wpilib.units.UnitBuilder< U extends Unit >.make | ( | UnitConstructorFunction< U > | constructor | ) |
Creates the new unit based off of the builder methods called prior, passing them to a provided constructor function.
| constructor | the function to use to create the new derived unit |
| NullPointerException | if the unit conversions, unit name, or unit symbol were not set |
Definition at line 224 of file UnitBuilder.java.
| MappingBuilder org.wpilib.units.UnitBuilder< U extends Unit >.mappingInputRange | ( | double | minBase, |
| double | maxBase ) |
Defines a mapping for values within the given input range. This method call should be immediately followed by .toOutputRange, eg mappingInputRange(1,, which will return the unit builder for continued chaining.
2).toOutputRange(3, 4)
| minBase | the minimum input value (does not have to be absolute) |
| maxBase | the maximum output value (does not have to be absolute) |
Definition at line 104 of file UnitBuilder.java.
| UnitBuilder< U > org.wpilib.units.UnitBuilder< U extends Unit >.named | ( | String | name | ) |
Sets the name of the new unit.
| name | the new name |
Definition at line 138 of file UnitBuilder.java.
| UnitBuilder< U > org.wpilib.units.UnitBuilder< U extends Unit >.offset | ( | double | offset | ) |
Sets the unit conversions based on a simple offset. The new unit will have its values equal to (base value - offset).
| offset | the offset |
Definition at line 45 of file UnitBuilder.java.
| UnitBuilder< U > org.wpilib.units.UnitBuilder< U extends Unit >.splitInto | ( | double | fraction | ) |
Helper for defining units that are a scalar fraction of the base unit, such as centimeters being 1/100th of the base unit (meters). The fraction value is specified as the denominator of the fraction, so a centimeter definition would use splitInto(100) instead of .
splitInto(1/100.0)
| fraction | the denominator portion of the fraction of the base unit that a value of 1 in the derived unit corresponds to |
Definition at line 164 of file UnitBuilder.java.
| UnitBuilder< U > org.wpilib.units.UnitBuilder< U extends Unit >.symbol | ( | String | symbol | ) |
Sets the symbol of the new unit.
| symbol | the new symbol |
Definition at line 149 of file UnitBuilder.java.
| UnitBuilder< U > org.wpilib.units.UnitBuilder< U extends Unit >.toBase | ( | UnaryFunction | toBase | ) |
Sets the conversion function to transform values in the derived unit to values in the base unit.
| toBase | the conversion function |
Definition at line 127 of file UnitBuilder.java.