Package edu.wpi.first.units.mutable
Class MutableMeasureBase<U extends Unit,Base extends Measure<U>,MutSelf extends MutableMeasure<U,Base,MutSelf>>
java.lang.Object
edu.wpi.first.units.mutable.MutableMeasureBase<U,Base,MutSelf>
- Type Parameters:
U
- The dimension of measurement.Base
- The base measure type.MutSelf
- The self type. This MUST inherit from the base measure type.
- All Implemented Interfaces:
Measure<U>
,MutableMeasure<U,
,Base, MutSelf> Comparable<Measure<U>>
- Direct Known Subclasses:
GenericMutableMeasureImpl
,MutAcceleration
,MutAngle
,MutAngularAcceleration
,MutAngularMomentum
,MutAngularVelocity
,MutCurrent
,MutDimensionless
,MutDistance
,MutEnergy
,MutForce
,MutFrequency
,MutLinearAcceleration
,MutLinearMomentum
,MutLinearVelocity
,MutMass
,MutMomentOfInertia
,MutMult
,MutPer
,MutPower
,MutResistance
,MutTemperature
,MutTime
,MutTorque
,MutVelocity
,MutVoltage
public abstract class MutableMeasureBase<U extends Unit,Base extends Measure<U>,MutSelf extends MutableMeasure<U,Base,MutSelf>>
extends Object
implements Measure<U>, MutableMeasure<U,Base,MutSelf>
A partial implementation of
MutableMeasure
to handle most of the state and Java object-
related implementations.-
Field Summary
Modifier and TypeFieldDescriptionprotected double
The magnitude of the measurement, in terms ofm_unit
's base unit.protected double
The magnitude of the measurement, in terms ofm_unit
.protected U
The unit of measurement.Fields inherited from interface edu.wpi.first.units.Measure
EQUIVALENCE_THRESHOLD
-
Constructor Summary
ModifierConstructorDescriptionprotected
MutableMeasureBase
(double magnitude, double baseUnitMagnitude, U unit) Initializes the mutable measure with initial conditions. -
Method Summary
Modifier and TypeMethodDescriptiondouble
Gets the magnitude of this measure in terms of the base unit.boolean
int
hashCode()
double
Gets the unitless magnitude of this measure.mut_replace
(double magnitude, U newUnit) Overwrites the state of this measure with new values.toString()
unit()
Gets the units of this measure.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface edu.wpi.first.units.Measure
abs, baseUnit, compareTo, copySign, div, div, div, div, div, div, div, div, div, div, div, div, div, div, div, div, div, div, div, div, div, div, div, div, div, div, div, divide, divide, divide, divide, divide, divide, divide, divide, divide, divide, divide, divide, divide, divide, divide, divide, divide, divide, divide, divide, divide, divide, divide, divide, divide, divide, divide, divideRatio, gt, gte, in, isEquivalent, isNear, isNear, lt, lte, minus, mutableCopy, negate, per, plus, times, times, times, times, times, times, times, times, times, times, times, times, times, times, times, times, times, times, times, times, times, times, times, times, times, times, times, timesConversionFactor, timesInverse, timesRatio, toLongString, toShortString, unaryMinus
Methods inherited from interface edu.wpi.first.units.MutableMeasure
copy, mut_acc, mut_acc, mut_divide, mut_divide, mut_minus, mut_minus, mut_plus, mut_plus, mut_replace, mut_setBaseUnitMagnitude, mut_setMagnitude, mut_times, mut_times
-
Field Details
-
Constructor Details
-
MutableMeasureBase
Initializes the mutable measure with initial conditions. Both relative and base unit magnitudes are required to avoid unnecessary calculations. It is up to the caller to ensure they are correct.- Parameters:
magnitude
- the initial magnitude of the measure, in terms of the unitbaseUnitMagnitude
- the initial magnitude of the measure, in terms of the base unitunit
- the initial unit of measure
-
-
Method Details
-
magnitude
Description copied from interface:Measure
Gets the unitless magnitude of this measure. -
baseUnitMagnitude
Description copied from interface:Measure
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 toMeasure.magnitude()
.- Specified by:
baseUnitMagnitude
in interfaceMeasure<U extends Unit>
- Returns:
- the magnitude in terms of the base unit
-
unit
Description copied from interface:Measure
Gets the units of this measure. -
toString
-
equals
-
hashCode
-
mut_replace
Description copied from interface:MutableMeasure
Overwrites the state of this measure with new values.- Specified by:
mut_replace
in interfaceMutableMeasure<U extends Unit,
Base extends Measure<U>, MutSelf extends MutableMeasure<U, Base, MutSelf>> - Parameters:
magnitude
- the new magnitude in terms of the new unitnewUnit
- the new unit- Returns:
- this measure
-