java.lang.Object
org.wpilib.units.CombinatoryUnitCache<A,B,Out>
- Type Parameters:
A- the type of the first unit to be combinedB- the type of the second unit to be combinedOut- the type of the combinatorial unit
-
Constructor Summary
ConstructorsConstructorDescriptionCombinatoryUnitCache(BiFunction<? super A, ? super B, ? extends Out> constructor) Creates a new combinatory unit cache. -
Method Summary
-
Constructor Details
-
CombinatoryUnitCache
Creates a new combinatory unit cache. The cache is initially empty and is not shared across instances.- Parameters:
constructor- the constructor function to use to create new combined units
-
-
Method Details
-
combine
Combines two units together and returns the result. The resulting units are cached and will be returned on successive calls to avoid allocating many duplicate objects. The combination output type is determined by the factory function passed into the cache's constructor.- Parameters:
a- the first unitb- the second unit- Returns:
- the combined unit
-