RobotCore 1.0
WPILib port to raspberry Pi
Loading...
Searching...
No Matches
org.wpilib.units.Measure< U extends Unit > Interface Template Reference
Inheritance diagram for org.wpilib.units.Measure< U extends Unit >:

Public Member Functions

double magnitude ()
double baseUnitMagnitude ()
U unit ()
default double in (U unit)
default U baseUnit ()
default double abs (U unit)
default double copySign (Measure< U > other, U unit)
Measure< U > unaryMinus ()
Measure< U > plus (Measure<? extends U > other)
Measure< U > minus (Measure<? extends U > other)
Measure< U > times (double multiplier)
Measure< U > times (Dimensionless multiplier)
default Measure<?> times (Measure<?> multiplier)
default Measure<?> times (Acceleration<?> multiplier)
default Measure<?> times (Angle multiplier)
default Measure<?> times (AngularAcceleration multiplier)
default Measure<?> times (AngularMomentum multiplier)
default Measure<?> times (AngularVelocity multiplier)
default Measure<?> times (Current multiplier)
default Measure<?> times (Distance multiplier)
default Measure<?> times (Energy multiplier)
default Measure<?> times (Force multiplier)
default Measure<?> times (Frequency multiplier)
default Measure<?> times (LinearAcceleration multiplier)
default Measure<?> times (LinearMomentum multiplier)
default Measure<?> times (LinearVelocity multiplier)
default Measure<?> times (Mass multiplier)
default Measure<?> times (MomentOfInertia multiplier)
default Measure<?> times (Mult<?, ?> multiplier)
default Measure<?> times (Power multiplier)
default Measure<?> times (Per<?, ?> multiplier)
default Measure<?> times (Temperature multiplier)
default Measure<?> times (Time multiplier)
default Measure<?> times (Torque multiplier)
default Measure<?> times (Velocity<?> multiplier)
default Measure<?> times (Voltage multiplier)
default Measure<?> times (Resistance multiplier)
default< Other extends Unit, M extends Measure< Other > > M timesConversionFactor (Measure<? extends PerUnit< Other, U > > conversionFactor)
default Dimensionless timesInverse (Measure<? extends PerUnit< DimensionlessUnit, ? extends U > > multiplier)
default< Other extends Unit > Measure< Other > timesRatio (Measure<? extends PerUnit<? extends Other, U > > ratio)
Measure< U > div (double divisor)
Measure< U > div (Dimensionless divisor)
default Measure<?> div (Measure<?> divisor)
default Measure<?> div (Acceleration<?> divisor)
default Measure<?> div (Angle divisor)
default Measure<?> div (AngularAcceleration divisor)
default Measure<?> div (AngularMomentum divisor)
default Measure<?> div (AngularVelocity divisor)
default Measure<?> div (Current divisor)
default Measure<?> div (Distance divisor)
default Measure<?> div (Energy divisor)
default Measure<?> div (Force divisor)
default Measure<?> div (Frequency divisor)
default Measure<?> div (LinearAcceleration divisor)
default Measure<?> div (LinearMomentum divisor)
default Measure<?> div (LinearVelocity divisor)
default Measure<?> div (Mass divisor)
default Measure<?> div (MomentOfInertia divisor)
default Measure<?> div (Mult<?, ?> divisor)
default Measure<?> div (Power divisor)
default Measure<?> div (Per<?, ?> divisor)
default Measure<?> div (Temperature divisor)
default Measure<?> div (Time divisor)
default Measure<?> div (Torque divisor)
default Measure<?> div (Velocity<?> divisor)
default Measure<?> div (Voltage divisor)
default Measure<?> div (Resistance divisor)
default Measure<?> per (AccelerationUnit<?> divisorUnit)
default Measure<?> per (AngleUnit divisorUnit)
default Measure<?> per (AngularAccelerationUnit divisorUnit)
default Measure<?> per (AngularMomentumUnit divisorUnit)
default Measure<?> per (AngularVelocityUnit divisorUnit)
default Measure<?> per (CurrentUnit divisorUnit)
default Measure<?> per (DistanceUnit divisorUnit)
default Measure<?> per (EnergyUnit divisorUnit)
default Measure<?> per (ForceUnit divisorUnit)
default Measure<?> per (FrequencyUnit divisorUnit)
default Measure<?> per (LinearAccelerationUnit divisorUnit)
default Measure<?> per (LinearMomentumUnit divisorUnit)
default Measure<?> per (LinearVelocityUnit divisorUnit)
default Measure<?> per (MassUnit divisorUnit)
default Measure<?> per (MomentOfInertiaUnit divisorUnit)
default Measure<?> per (MultUnit<?, ?> divisorUnit)
default Measure<?> per (PowerUnit divisorUnit)
default Measure<?> per (PerUnit<?, ?> divisorUnit)
default Measure<?> per (TemperatureUnit divisorUnit)
default Measure<?> per (TimeUnit period)
default Measure<?> per (TorqueUnit divisorUnit)
default Measure<?> per (VelocityUnit<?> divisorUnit)
default Measure<?> per (VoltageUnit divisorUnit)
default Measure<?> per (ResistanceUnit divisorUnit)
default< Other extends Unit > Measure< Other > divideRatio (Measure<? extends PerUnit<? extends U, Other > > divisor)
default boolean isNear (Measure<?> other, double varianceThreshold)
default boolean isNear (Measure< U > other, Measure< U > tolerance)
default boolean isEquivalent (Measure<?> other)
default int compareTo (Measure< U > o)
default boolean gt (Measure< U > o)
default boolean gte (Measure< U > o)
default boolean lt (Measure< U > o)
default boolean lte (Measure< U > o)
static< U extends Unit, T extends Measure< U > > T max (T... measures)
static< U extends Unit, T extends Measure< U > > T min (T... measures)
default String toShortString ()
default String toLongString ()

Public Attributes

double EQUIVALENCE_THRESHOLD = 1e-12

Detailed Description

A measure holds the magnitude and unit of some dimension, such as distance, time, or velocity. Two measures with the same unit and magnitude are effectively equivalent objects.

Parameters
<U>the unit type of the measure

Definition at line 41 of file Measure.java.

Member Function Documentation

◆ abs()

default double org.wpilib.units.Measure< U extends Unit >.abs ( U unit)

Absolute value of measure.

Parameters
unitunit to use
Returns
the absolute value of this measure in the given unit

Definition at line 107 of file Measure.java.

◆ baseUnit()

default U org.wpilib.units.Measure< U extends Unit >.baseUnit ( )

A convenience method to get the base unit of the measurement. Equivalent to
unit().getBaseUnit()
.

Returns
the base unit of measure.

Definition at line 97 of file Measure.java.

◆ baseUnitMagnitude()

double org.wpilib.units.Measure< U extends Unit >.baseUnitMagnitude ( )

Gets the magnitude of this measure in terms of the base unit. If the unit is the base unit for its system of measure, then the value will be equivalent to magnitude().

Returns
the magnitude in terms of the base unit

◆ compareTo()

default int org.wpilib.units.Measure< U extends Unit >.compareTo ( Measure< U > o)

Definition at line 1276 of file Measure.java.

◆ copySign()

default double org.wpilib.units.Measure< U extends Unit >.copySign ( Measure< U > other,
U unit )

Take the sign of another measure.

Parameters
othermeasure from which to take sign
unitunit to use
Returns
the value of the measure in the given unit with the sign of the provided measure

Definition at line 118 of file Measure.java.

◆ div() [1/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.div ( Acceleration<?> divisor)

Divides this measure by a generic acceleration and returns the result in the most appropriate unit.

Parameters
divisorthe measurement to divide by.
Returns
the division result

Definition at line 671 of file Measure.java.

◆ div() [2/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.div ( Angle divisor)

Divides this measure by an angle and returns the result in the most appropriate unit.

Parameters
divisorthe measurement to divide by.
Returns
the division result

Definition at line 682 of file Measure.java.

◆ div() [3/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.div ( AngularAcceleration divisor)

Divides this measure by an angular acceleration and returns the result in the most appropriate unit.

Parameters
divisorthe measurement to divide by.
Returns
the division result

Definition at line 694 of file Measure.java.

◆ div() [4/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.div ( AngularMomentum divisor)

Divides this measure by an angular momentum and returns the result in the most appropriate unit.

Parameters
divisorthe measurement to divide by.
Returns
the division result

Definition at line 706 of file Measure.java.

◆ div() [5/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.div ( AngularVelocity divisor)

Divides this measure by an angular velocity and returns the result in the most appropriate unit.

Parameters
divisorthe measurement to divide by.
Returns
the division result

Definition at line 718 of file Measure.java.

◆ div() [6/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.div ( Current divisor)

Divides this measure by an electric current and returns the result in the most appropriate unit.

Parameters
divisorthe measurement to divide by.
Returns
the division result

Definition at line 730 of file Measure.java.

◆ div() [7/27]

Measure< U > org.wpilib.units.Measure< U extends Unit >.div ( Dimensionless divisor)

Divides this measure by a dimensionless scalar and returns the result.

Parameters
divisorthe measurement to divide by.
Returns
the division result

◆ div() [8/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.div ( Distance divisor)

Divides this measure by a distance and returns the result in the most appropriate unit.

Parameters
divisorthe measurement to divide by.
Returns
the division result

Definition at line 741 of file Measure.java.

◆ div() [9/27]

Measure< U > org.wpilib.units.Measure< U extends Unit >.div ( double divisor)

Divides this measure by a unitless scalar and returns the result.

Parameters
divisorthe measurement to divide by.
Returns
the division result

◆ div() [10/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.div ( Energy divisor)

Divides this measure by an energy and returns the result in the most appropriate unit.

Parameters
divisorthe measurement to divide by.
Returns
the division result

Definition at line 752 of file Measure.java.

◆ div() [11/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.div ( Force divisor)

Divides this measure by a force and returns the result in the most appropriate unit.

Parameters
divisorthe measurement to divide by.
Returns
the division result

Definition at line 763 of file Measure.java.

◆ div() [12/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.div ( Frequency divisor)

Divides this measure by a frequency and returns the result in the most appropriate unit.

Parameters
divisorthe measurement to divide by.
Returns
the division result

Definition at line 774 of file Measure.java.

◆ div() [13/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.div ( LinearAcceleration divisor)

Divides this measure by a linear acceleration and returns the result in the most appropriate unit.

Parameters
divisorthe measurement to divide by.
Returns
the division result

Definition at line 786 of file Measure.java.

◆ div() [14/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.div ( LinearMomentum divisor)

Divides this measure by a linear momentum and returns the result in the most appropriate unit.

Parameters
divisorthe measurement to divide by.
Returns
the division result

Definition at line 797 of file Measure.java.

◆ div() [15/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.div ( LinearVelocity divisor)

Divides this measure by a linear velocity and returns the result in the most appropriate unit.

Parameters
divisorthe measurement to divide by.
Returns
the division result

Definition at line 808 of file Measure.java.

◆ div() [16/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.div ( Mass divisor)

Divides this measure by a mass and returns the result in the most appropriate unit.

Parameters
divisorthe measurement to divide by.
Returns
the division result

Definition at line 819 of file Measure.java.

◆ div() [17/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.div ( Measure<?> divisor)

Divides this measurement by another measure and performs some dimensional analysis to reduce the units.

Parameters
divisorthe unit to divide by
Returns
the resulting measure

Definition at line 600 of file Measure.java.

◆ div() [18/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.div ( MomentOfInertia divisor)

Divides this measure by a moment of inertia and returns the result in the most appropriate unit.

Parameters
divisorthe measurement to divide by.
Returns
the division result

Definition at line 831 of file Measure.java.

◆ div() [19/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.div ( Mult<?, ?> divisor)

Divides this measure by a generic multiplication and returns the result in the most appropriate unit.

Parameters
divisorthe measurement to divide by.
Returns
the division result

Definition at line 843 of file Measure.java.

◆ div() [20/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.div ( Per<?, ?> divisor)

Divides this measure by a generic ratio and returns the result in the most appropriate unit.

Parameters
divisorthe measurement to divide by.
Returns
the division result

Definition at line 865 of file Measure.java.

◆ div() [21/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.div ( Power divisor)

Divides this measure by a power and returns the result in the most appropriate unit.

Parameters
divisorthe measurement to divide by.
Returns
the division result

Definition at line 854 of file Measure.java.

◆ div() [22/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.div ( Resistance divisor)

Divides this measure by a resistance and returns the result in the most appropriate unit.

Parameters
divisorthe measurement to divide by.
Returns
the division result

Definition at line 933 of file Measure.java.

◆ div() [23/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.div ( Temperature divisor)

Divides this measure by a temperature and returns the result in the most appropriate unit.

Parameters
divisorthe measurement to divide by.
Returns
the division result

Definition at line 876 of file Measure.java.

◆ div() [24/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.div ( Time divisor)

Divides this measure by a time and returns the result in the most appropriate unit. This will often - but not always - result in a Per type like LinearVelocity or Acceleration.

Parameters
divisorthe measurement to divide by.
Returns
the division result

Definition at line 889 of file Measure.java.

◆ div() [25/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.div ( Torque divisor)

Divides this measure by a torque and returns the result in the most appropriate unit.

Parameters
divisorthe measurement to divide by.
Returns
the division result

Definition at line 900 of file Measure.java.

◆ div() [26/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.div ( Velocity<?> divisor)

Divides this measure by a generic velocity and returns the result in the most appropriate unit.

Parameters
divisorthe measurement to divide by.
Returns
the division result

Definition at line 911 of file Measure.java.

◆ div() [27/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.div ( Voltage divisor)

Divides this measure by a voltage and returns the result in the most appropriate unit.

Parameters
divisorthe measurement to divide by.
Returns
the division result

Definition at line 922 of file Measure.java.

◆ divideRatio()

default< Other extends Unit > Measure< Other > org.wpilib.units.Measure< U extends Unit >.divideRatio ( Measure<? extends PerUnit<? extends U, Other > > divisor)

Divides this measure by a ratio in terms of this measurement's unit to another unit, returning a measurement in terms of the other unit.

Parameters
divisorthe measurement to divide by.
<Other>the other unit that results are in terms of
Returns
the division result

Definition at line 1211 of file Measure.java.

◆ gt()

default boolean org.wpilib.units.Measure< U extends Unit >.gt ( Measure< U > o)

Checks if this measure is greater than another measure of the same unit.

Parameters
othe other measure to compare to
Returns
true if this measure has a greater equivalent magnitude, false otherwise

Definition at line 1286 of file Measure.java.

◆ gte()

default boolean org.wpilib.units.Measure< U extends Unit >.gte ( Measure< U > o)

Checks if this measure is greater than or equivalent to another measure of the same unit.

Parameters
othe other measure to compare to
Returns
true if this measure has an equal or greater equivalent magnitude, false otherwise

Definition at line 1296 of file Measure.java.

◆ in()

default double org.wpilib.units.Measure< U extends Unit >.in ( U unit)

Converts this measure to a measure with a different unit of the same type, eg minutes to seconds. Converting to the same unit is equivalent to calling magnitude().

  Meters.of(12).in(Feet) // 39.3701
  Seconds.of(15).in(Minutes) // 0.25
Parameters
unitthe unit to convert this measure to
Returns
the value of this measure in the given unit

Definition at line 82 of file Measure.java.

◆ isEquivalent()

default boolean org.wpilib.units.Measure< U extends Unit >.isEquivalent ( Measure<?> other)

Checks if this measure is equivalent to another measure of the same unit.

Parameters
otherthe measure to compare to
Returns
true if this measure is equivalent, false otherwise

Definition at line 1268 of file Measure.java.

◆ isNear() [1/2]

default boolean org.wpilib.units.Measure< U extends Unit >.isNear ( Measure< U > other,
Measure< U > tolerance )

Checks if this measure is near another measure of the same unit, with a specified tolerance of the same unit.

    Meters.of(1).isNear(Meters.of(1.2), Millimeters.of(300)) // true
    Degrees.of(90).isNear(Rotations.of(0.5), Degrees.of(45)) // false
Parameters
otherthe other measure to compare against.
tolerancethe tolerance allowed in which the two measures are defined as near each other.
Returns
true if this unit is near the other measure, otherwise false.

Definition at line 1257 of file Measure.java.

◆ isNear() [2/2]

default boolean org.wpilib.units.Measure< U extends Unit >.isNear ( Measure<?> other,
double varianceThreshold )

Checks if this measure is near another measure of the same unit. Provide a variance threshold for use for a +/- scalar, such as 0.05 for +/- 5%.

  Inches.of(11).isNear(Inches.of(10), 0.1) // true
  Inches.of(12).isNear(Inches.of(10), 0.1) // false
Parameters
otherthe other measurement to compare against
varianceThresholdthe acceptable variance threshold, in terms of an acceptable +/- error range multiplier. Checking if a value is within 10% means a value of 0.1 should be passed; checking if a value is within 1% means a value of 0.01 should be passed, and so on.
Returns
true if this unit is near the other measure, otherwise false

Definition at line 1232 of file Measure.java.

◆ lt()

default boolean org.wpilib.units.Measure< U extends Unit >.lt ( Measure< U > o)

Checks if this measure is less than another measure of the same unit.

Parameters
othe other measure to compare to
Returns
true if this measure has a lesser equivalent magnitude, false otherwise

Definition at line 1306 of file Measure.java.

◆ lte()

default boolean org.wpilib.units.Measure< U extends Unit >.lte ( Measure< U > o)

Checks if this measure is less than or equivalent to another measure of the same unit.

Parameters
othe other measure to compare to
Returns
true if this measure has an equal or lesser equivalent magnitude, false otherwise

Definition at line 1316 of file Measure.java.

◆ magnitude()

double org.wpilib.units.Measure< U extends Unit >.magnitude ( )

Gets the unitless magnitude of this measure.

Returns
the magnitude in terms of the unit.

◆ max()

static< U extends Unit, T extends Measure< U > > T org.wpilib.units.Measure< U extends Unit >.max ( T... measures)

Returns the measure with the absolute value closest to positive infinity.

Parameters
<U>the type of the units of the measures
<T>the common type of the measures
measuresthe set of measures to compare
Returns
the measure with the greatest positive magnitude, or null if no measures were provided

Definition at line 1329 of file Measure.java.

◆ min()

static< U extends Unit, T extends Measure< U > > T org.wpilib.units.Measure< U extends Unit >.min ( T... measures)

Returns the measure with the absolute value closest to negative infinity.

Parameters
<U>the type of the units of the measures
<T>the common type of the measures
measuresthe set of measures to compare
Returns
the measure with the greatest negative magnitude

Definition at line 1353 of file Measure.java.

◆ minus()

Measure< U > org.wpilib.units.Measure< U extends Unit >.minus ( Measure<? extends U > other)

Subtracts another measure of the same unit type from this one.

Parameters
otherthe measurement to subtract
Returns
a measure of the difference between the measures

◆ per() [1/24]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.per ( AccelerationUnit<?> divisorUnit)

Divides this measure by an acceleration unit and returns the result in the most appropriate unit. This is equivalent to div(divisorUnit.of(1)).

Parameters
divisorUnitthe unit to divide by.
Returns
the division result

Definition at line 945 of file Measure.java.

◆ per() [2/24]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.per ( AngleUnit divisorUnit)

Divides this measure by an angle unit and returns the result in the most appropriate unit. This is equivalent to div(divisorUnit.of(1)).

Parameters
divisorUnitthe unit to divide by.
Returns
the division result

Definition at line 956 of file Measure.java.

◆ per() [3/24]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.per ( AngularAccelerationUnit divisorUnit)

Divides this measure by an angular acceleration unit and returns the result in the most appropriate unit. This is equivalent to div(divisorUnit.of(1)).

Parameters
divisorUnitthe unit to divide by.
Returns
the division result

Definition at line 967 of file Measure.java.

◆ per() [4/24]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.per ( AngularMomentumUnit divisorUnit)

Divides this measure by an angular momentum unit and returns the result in the most appropriate unit. This is equivalent to div(divisorUnit.of(1)).

Parameters
divisorUnitthe unit to divide by.
Returns
the division result

Definition at line 978 of file Measure.java.

◆ per() [5/24]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.per ( AngularVelocityUnit divisorUnit)

Divides this measure by an angular velocity unit and returns the result in the most appropriate unit. This is equivalent to div(divisorUnit.of(1)).

Parameters
divisorUnitthe unit to divide by.
Returns
the division result

Definition at line 989 of file Measure.java.

◆ per() [6/24]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.per ( CurrentUnit divisorUnit)

Divides this measure by a unit of electric current and returns the result in the most appropriate unit. This is equivalent to div(divisorUnit.of(1)).

Parameters
divisorUnitthe unit to divide by.
Returns
the division result

Definition at line 1000 of file Measure.java.

◆ per() [7/24]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.per ( DistanceUnit divisorUnit)

Divides this measure by a distance unit and returns the result in the most appropriate unit. This is equivalent to div(divisorUnit.of(1)).

Parameters
divisorUnitthe unit to divide by.
Returns
the division result

Definition at line 1011 of file Measure.java.

◆ per() [8/24]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.per ( EnergyUnit divisorUnit)

Divides this measure by an energy unit and returns the result in the most appropriate unit. This is equivalent to div(divisorUnit.of(1)).

Parameters
divisorUnitthe unit to divide by.
Returns
the division result

Definition at line 1022 of file Measure.java.

◆ per() [9/24]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.per ( ForceUnit divisorUnit)

Divides this measure by a force unit and returns the result in the most appropriate unit. This is equivalent to div(divisorUnit.of(1)).

Parameters
divisorUnitthe unit to divide by.
Returns
the division result

Definition at line 1033 of file Measure.java.

◆ per() [10/24]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.per ( FrequencyUnit divisorUnit)

Divides this measure by a frequency unit and returns the result in the most appropriate unit. This is equivalent to div(divisorUnit.of(1)).

Parameters
divisorUnitthe unit to divide by.
Returns
the division result

Definition at line 1044 of file Measure.java.

◆ per() [11/24]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.per ( LinearAccelerationUnit divisorUnit)

Divides this measure by a linear acceleration unit and returns the result in the most appropriate unit. This is equivalent to div(divisorUnit.of(1)).

Parameters
divisorUnitthe unit to divide by.
Returns
the division result

Definition at line 1055 of file Measure.java.

◆ per() [12/24]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.per ( LinearMomentumUnit divisorUnit)

Divides this measure by a linear momentum unit and returns the result in the most appropriate unit. This is equivalent to div(divisorUnit.of(1)).

Parameters
divisorUnitthe unit to divide by.
Returns
the division result

Definition at line 1066 of file Measure.java.

◆ per() [13/24]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.per ( LinearVelocityUnit divisorUnit)

Divides this measure by a linear velocity unit and returns the result in the most appropriate unit. This is equivalent to div(divisorUnit.of(1)).

Parameters
divisorUnitthe unit to divide by.
Returns
the division result

Definition at line 1077 of file Measure.java.

◆ per() [14/24]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.per ( MassUnit divisorUnit)

Divides this measure by a mass unit and returns the result in the most appropriate unit. This is equivalent to div(divisorUnit.of(1)).

Parameters
divisorUnitthe unit to divide by.
Returns
the division result

Definition at line 1088 of file Measure.java.

◆ per() [15/24]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.per ( MomentOfInertiaUnit divisorUnit)

Divides this measure by a moment of inertia unit and returns the result in the most appropriate unit. This is equivalent to div(divisorUnit.of(1)).

Parameters
divisorUnitthe unit to divide by.
Returns
the division result

Definition at line 1099 of file Measure.java.

◆ per() [16/24]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.per ( MultUnit<?, ?> divisorUnit)

Divides this measure by a generic compound unit and returns the result in the most appropriate unit. This is equivalent to div(divisorUnit.of(1)).

Parameters
divisorUnitthe unit to divide by.
Returns
the division result

Definition at line 1110 of file Measure.java.

◆ per() [17/24]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.per ( PerUnit<?, ?> divisorUnit)

Divides this measure by a generic ratio unit and returns the result in the most appropriate unit. This is equivalent to div(divisorUnit.of(1)).

Parameters
divisorUnitthe unit to divide by.
Returns
the division result

Definition at line 1132 of file Measure.java.

◆ per() [18/24]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.per ( PowerUnit divisorUnit)

Divides this measure by a power unit and returns the result in the most appropriate unit. This is equivalent to div(divisorUnit.of(1)).

Parameters
divisorUnitthe unit to divide by.
Returns
the division result

Definition at line 1121 of file Measure.java.

◆ per() [19/24]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.per ( ResistanceUnit divisorUnit)

Divides this measure by a resistance unit and returns the result in the most appropriate unit. This is equivalent to div(divisorUnit.of(1)).

Parameters
divisorUnitthe unit to divide by.
Returns
the division result

Definition at line 1198 of file Measure.java.

◆ per() [20/24]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.per ( TemperatureUnit divisorUnit)

Divides this measure by a temperature unit and returns the result in the most appropriate unit. This is equivalent to div(divisorUnit.of(1)).

Parameters
divisorUnitthe unit to divide by.
Returns
the division result

Definition at line 1143 of file Measure.java.

◆ per() [21/24]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.per ( TimeUnit period)

Divides this measure by a time period and returns the result in the most appropriate unit. This is equivalent to div(period.of(1)).

Parameters
periodthe time period measurement to divide by.
Returns
the division result

Definition at line 1154 of file Measure.java.

◆ per() [22/24]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.per ( TorqueUnit divisorUnit)

Divides this measure by a torque unit and returns the result in the most appropriate unit. This is equivalent to div(divisorUnit.of(1)).

Parameters
divisorUnitthe unit to divide by.
Returns
the division result

Definition at line 1165 of file Measure.java.

◆ per() [23/24]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.per ( VelocityUnit<?> divisorUnit)

Divides this measure by a velocity unit and returns the result in the most appropriate unit. This is equivalent to div(divisorUnit.of(1)).

Parameters
divisorUnitthe unit to divide by.
Returns
the division result

Definition at line 1176 of file Measure.java.

◆ per() [24/24]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.per ( VoltageUnit divisorUnit)

Divides this measure by a voltage unit and returns the result in the most appropriate unit. This is equivalent to div(divisorUnit.of(1)).

Parameters
divisorUnitthe unit to divide by.
Returns
the division result

Definition at line 1187 of file Measure.java.

◆ plus()

Measure< U > org.wpilib.units.Measure< U extends Unit >.plus ( Measure<? extends U > other)

Adds another measure of the same unit type to this one.

Parameters
otherthe measurement to add
Returns
a measure of the sum of both measures

◆ times() [1/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.times ( Acceleration<?> multiplier)

Multiplies this measure by an acceleration and returns the resulting measure in the most appropriate unit.

Parameters
multiplierthe measurement to multiply by.
Returns
the multiplication result

Definition at line 247 of file Measure.java.

◆ times() [2/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.times ( Angle multiplier)

Multiplies this measure by an angle and returns the resulting measure in the most appropriate unit.

Parameters
multiplierthe measurement to multiply by.
Returns
the multiplication result

Definition at line 259 of file Measure.java.

◆ times() [3/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.times ( AngularAcceleration multiplier)

Multiplies this measure by an angular acceleration and returns the resulting measure in the most appropriate unit.

Parameters
multiplierthe measurement to multiply by.
Returns
the multiplication result

Definition at line 271 of file Measure.java.

◆ times() [4/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.times ( AngularMomentum multiplier)

Multiplies this measure by an angular momentum and returns the resulting measure in the most appropriate unit.

Parameters
multiplierthe measurement to multiply by.
Returns
the multiplication result

Definition at line 283 of file Measure.java.

◆ times() [5/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.times ( AngularVelocity multiplier)

Multiplies this measure by an angular velocity and returns the resulting measure in the most appropriate unit.

Parameters
multiplierthe measurement to multiply by.
Returns
the multiplication result

Definition at line 295 of file Measure.java.

◆ times() [6/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.times ( Current multiplier)

Multiplies this measure by an electric current and returns the resulting measure in the most appropriate unit.

Parameters
multiplierthe measurement to multiply by.
Returns
the multiplication result

Definition at line 307 of file Measure.java.

◆ times() [7/27]

Measure< U > org.wpilib.units.Measure< U extends Unit >.times ( Dimensionless multiplier)

Multiplies this measure by a scalar dimensionless multiplier.

Parameters
multiplierthe scalar multiplication factor
Returns
the scaled result

◆ times() [8/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.times ( Distance multiplier)

Multiplies this measure by a distance and returns the resulting measure in the most appropriate unit.

Parameters
multiplierthe measurement to multiply by.
Returns
the multiplication result

Definition at line 319 of file Measure.java.

◆ times() [9/27]

Measure< U > org.wpilib.units.Measure< U extends Unit >.times ( double multiplier)

Multiplies this measure by a scalar unitless multiplier.

Parameters
multiplierthe scalar multiplication factor
Returns
the scaled result

◆ times() [10/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.times ( Energy multiplier)

Multiplies this measure by an energy and returns the resulting measure in the most appropriate unit.

Parameters
multiplierthe measurement to multiply by.
Returns
the multiplication result

Definition at line 331 of file Measure.java.

◆ times() [11/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.times ( Force multiplier)

Multiplies this measure by a force and returns the resulting measure in the most appropriate unit.

Parameters
multiplierthe measurement to multiply by.
Returns
the multiplication result

Definition at line 343 of file Measure.java.

◆ times() [12/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.times ( Frequency multiplier)

Multiplies this measure by a frequency and returns the resulting measure in the most appropriate unit. This often - but not always - means implementations return a variation of a Per measure.

Parameters
multiplierthe measurement to multiply by.
Returns
the multiplication result

Definition at line 356 of file Measure.java.

◆ times() [13/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.times ( LinearAcceleration multiplier)

Multiplies this measure by a linear acceleration and returns the resulting measure in the most appropriate unit.

Parameters
multiplierthe measurement to multiply by.
Returns
the multiplication result

Definition at line 368 of file Measure.java.

◆ times() [14/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.times ( LinearMomentum multiplier)

Multiplies this measure by a linear momentum and returns the resulting measure in the most appropriate unit.

Parameters
multiplierthe measurement to multiply by.
Returns
the multiplication result

Definition at line 380 of file Measure.java.

◆ times() [15/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.times ( LinearVelocity multiplier)

Multiplies this measure by a linear velocity and returns the resulting measure in the most appropriate unit.

Parameters
multiplierthe measurement to multiply by.
Returns
the multiplication result

Definition at line 392 of file Measure.java.

◆ times() [16/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.times ( Mass multiplier)

Multiplies this measure by a mass and returns the resulting measure in the most appropriate unit.

Parameters
multiplierthe measurement to multiply by.
Returns
the multiplication result

Definition at line 404 of file Measure.java.

◆ times() [17/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.times ( Measure<?> multiplier)

Generates a new measure that is equal to this measure multiplied by another. Some dimensional analysis is performed to reduce the units down somewhat; for example, multiplying a
Measure<Time>
by a Measure<Velocity<Distance>> will return just a
Measure<Distance>
instead of the naive Measure<Mult<Time, Velocity<Distance>>. This is not guaranteed to perform perfect dimensional analysis.

Parameters
multiplierthe unit to multiply by
Returns
the multiplicative unit

Definition at line 174 of file Measure.java.

◆ times() [18/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.times ( MomentOfInertia multiplier)

Multiplies this measure by a moment of intertia and returns the resulting measure in the most appropriate unit.

Parameters
multiplierthe measurement to multiply by.
Returns
the multiplication result

Definition at line 416 of file Measure.java.

◆ times() [19/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.times ( Mult<?, ?> multiplier)

Multiplies this measure by a generic multiplied measure and returns the resulting measure in the most appropriate unit.

Parameters
multiplierthe measurement to multiply by.
Returns
the multiplication result

Definition at line 428 of file Measure.java.

◆ times() [20/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.times ( Per<?, ?> multiplier)

Multiplies this measure by a generic ratio measurement and returns the resulting measure in the most appropriate unit.

Parameters
multiplierthe measurement to multiply by.
Returns
the multiplication result

Definition at line 452 of file Measure.java.

◆ times() [21/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.times ( Power multiplier)

Multiplies this measure by a power and returns the resulting measure in the most appropriate unit.

Parameters
multiplierthe measurement to multiply by.
Returns
the multiplication result

Definition at line 440 of file Measure.java.

◆ times() [22/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.times ( Resistance multiplier)

Multiplies this measure by a resistance and returns the resulting measure in the most appropriate unit.

Parameters
multiplierthe measurement to multiply by.
Returns
the multiplication result

Definition at line 524 of file Measure.java.

◆ times() [23/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.times ( Temperature multiplier)

Multiplies this measure by a temperature and returns the resulting measure in the most appropriate unit.

Parameters
multiplierthe measurement to multiply by.
Returns
the multiplication result

Definition at line 464 of file Measure.java.

◆ times() [24/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.times ( Time multiplier)

Multiplies this measure by a time and returns the resulting measure in the most appropriate unit.

Parameters
multiplierthe measurement to multiply by.
Returns
the multiplication result

Definition at line 476 of file Measure.java.

◆ times() [25/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.times ( Torque multiplier)

Multiplies this measure by a torque and returns the resulting measure in the most appropriate unit.

Parameters
multiplierthe measurement to multiply by.
Returns
the multiplication result

Definition at line 488 of file Measure.java.

◆ times() [26/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.times ( Velocity<?> multiplier)

Multiplies this measure by a generic velocity and returns the resulting measure in the most appropriate unit.

Parameters
multiplierthe measurement to multiply by.
Returns
the multiplication result

Definition at line 500 of file Measure.java.

◆ times() [27/27]

default Measure<?> org.wpilib.units.Measure< U extends Unit >.times ( Voltage multiplier)

Multiplies this measure by a voltage and returns the resulting measure in the most appropriate unit.

Parameters
multiplierthe measurement to multiply by.
Returns
the multiplication result

Definition at line 512 of file Measure.java.

◆ timesConversionFactor()

default< Other extends Unit, M extends Measure< Other > > M org.wpilib.units.Measure< U extends Unit >.timesConversionFactor ( Measure<? extends PerUnit< Other, U > > conversionFactor)

Multiplies this measure by a conversion factor, returning the converted measurement. Unlike times(Per), this allows for basic unit cancellation to return measurements of a known dimension.

Parameters
conversionFactorthe conversion factor by which to multiply
<Other>the unit type to convert to
<M>the concrete return unit type. Note: the conversion factor's numerator unit must return instances of this type from Unit#ofBaseUnits(double)}
Returns
the converted result

Definition at line 541 of file Measure.java.

◆ timesInverse()

default Dimensionless org.wpilib.units.Measure< U extends Unit >.timesInverse ( Measure<? extends PerUnit< DimensionlessUnit, ? extends U > > multiplier)

Multiplies this measure by another measurement of the inverse unit type (eg Time multiplied by Frequency) and returns the resulting dimensionless measure.

Parameters
multiplierthe measurement to multiply by.
Returns
the multiplication result

Definition at line 558 of file Measure.java.

◆ timesRatio()

default< Other extends Unit > Measure< Other > org.wpilib.units.Measure< U extends Unit >.timesRatio ( Measure<? extends PerUnit<? extends Other, U > > ratio)

Multiplies this measure by another measurement of something over the unit type (eg Time multiplied by LinearVelocity) and returns the resulting measure of the ratio's dividend unit.

Parameters
ratiothe measurement to multiply by.
<Other>other unit that the results are in terms of
Returns
the multiplication result

Definition at line 571 of file Measure.java.

◆ toLongString()

default String org.wpilib.units.Measure< U extends Unit >.toLongString ( )

Returns a string representation of this measurement in a longhand form. The name of the backing unit is used, rather than its symbol, and the magnitude is represented in a full string, not scientific notation. (Very large values may be represented in scientific notation, however)

Returns
the long form representation of this measurement

Definition at line 1387 of file Measure.java.

◆ toShortString()

default String org.wpilib.units.Measure< U extends Unit >.toShortString ( )

Returns a string representation of this measurement in a shorthand form. The symbol of the backing unit is used, rather than the full name, and the magnitude is represented in scientific notation.

Returns
the short form representation of this measurement

Definition at line 1375 of file Measure.java.

◆ unaryMinus()

Measure< U > org.wpilib.units.Measure< U extends Unit >.unaryMinus ( )

Returns a measure equivalent to this one equal to zero minus its current value. For non-linear unit types like temperature, the zero point is treated as the zero value of the base unit (eg Kelvin). In effect, this means code like Celsius.of(10).unaryMinus() returns a value equivalent to -10 Kelvin, and not -10° Celsius.

Returns
a measure equal to zero minus this measure

◆ unit()

U org.wpilib.units.Measure< U extends Unit >.unit ( )

Gets the units of this measure.

Returns
the unit

Member Data Documentation

◆ EQUIVALENCE_THRESHOLD

double org.wpilib.units.Measure< U extends Unit >.EQUIVALENCE_THRESHOLD = 1e-12

The threshold for two measures to be considered equivalent if converted to the same unit. This is only needed due to floating-point error.

Definition at line 46 of file Measure.java.


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