Class Velocity<D extends Unit<D>>
public class Velocity<D extends Unit<D>> extends Unit<Velocity<D>>
This is the base type for units of velocity dimension. It is also used in combination with a
distance dimension to specify the dimension for Measure
. For example:
Measure<Velocity<Distance>>
.
Actual units (such as Units.MetersPerSecond
and Units.RPM
) can be found in the
Units
class.
-
Method Summary
Modifier and Type Method Description static <D extends Unit<D>>
Velocity<D>combine(Unit<D> numerator, Time period)
Creates a new velocity unit derived from an arbitrary numerator and time period units.static <D extends Unit<D>>
Velocity<D>combine(Unit<D> numerator, Time period, String name, String symbol)
Creates a new velocity unit derived from an arbitrary numerator and time period units.boolean
equals(Object o)
Time
getPeriod()
Gets the period unit of the velocity, eg Seconds or Milliseconds.D
getUnit()
Gets the major unit being measured (eg Meters for Meters per Second).int
hashCode()
Methods inherited from class edu.wpi.first.units.Unit
convertFrom, equivalent, fromBaseUnits, getConverterFromBase, getConverterToBase, mult, name, of, ofBaseUnits, one, per, per, symbol, toBaseUnits, toString, zero
-
Method Details
-
combine
public static <D extends Unit<D>> Velocity<D> combine(Unit<D> numerator, Time period, String name, String symbol)Creates a new velocity unit derived from an arbitrary numerator and time period units.Results of this method are cached so future invocations with the same arguments will return the pre-existing units instead of generating new identical ones.
Velocity.combine(Kilograms, Second) // mass flow Velocity.combine(Feet, Millisecond) // linear speed Velocity.combine(Radians, Second) // angular speed Velocity.combine(Feet.per(Second), Second) // linear acceleration in ft/s/s Velocity.combine(Radians.per(Second), Second) // angular acceleration
It's recommended to use the convenience function
Unit.per(Time)
instead of calling this factory directly.- Type Parameters:
D
- the type of the numerator unit- Parameters:
numerator
- the numerator unitperiod
- the period for unit timename
- the name of the new velocity unitsymbol
- the symbol of the new velocity unit- Returns:
- the new unit
-
combine
Creates a new velocity unit derived from an arbitrary numerator and time period units.Results of this method are cached so future invocations with the same arguments will return the pre-existing units instead of generating new identical ones.
This method automatically generates a new name and symbol for the new velocity unit.
Velocity.combine(Kilograms, Second) // mass flow Velocity.combine(Feet, Millisecond) // linear speed Velocity.combine(Radians, Second) // angular speed Velocity.combine(Feet.per(Second), Second) // linear acceleration in ft/s/s Velocity.combine(Radians.per(Second), Second) // angular acceleration
It's recommended to use the convenience function
Unit.per(Time)
instead of calling this factory directly.- Type Parameters:
D
- the type of the numerator unit- Parameters:
numerator
- the numerator unitperiod
- the period for unit time- Returns:
- the new unit
-
getUnit
Gets the major unit being measured (eg Meters for Meters per Second).- Returns:
- the major unit
-
getPeriod
Gets the period unit of the velocity, eg Seconds or Milliseconds.- Returns:
- the period unit
-
equals
-
hashCode
-