RobotCore 1.0
WPILib port to raspberry Pi
Loading...
Searching...
No Matches
org.wpilib.units.MassUnit Class Reference
Inheritance diagram for org.wpilib.units.MassUnit:
org.wpilib.units.Unit

Public Member Functions

MassUnit getBaseUnit ()
Mass of (double magnitude)
Mass ofBaseUnits (double baseUnitMagnitude)
Mass zero ()
Mass one ()
VelocityUnit< MassUnit > per (TimeUnit period)
double convertFrom (double magnitude, MassUnit otherUnit)
LinearMomentumUnit mult (LinearVelocityUnit velocity)
ForceUnit mult (LinearAccelerationUnit acceleration)
Public Member Functions inherited from org.wpilib.units.Unit
boolean isBaseUnit ()
double fromBaseUnits (double valueInBaseUnits)
double toBaseUnits (double valueInNativeUnits)
UnaryFunction getConverterToBase ()
UnaryFunction getConverterFromBase ()
boolean equivalent (Unit other)
boolean equals (Object o)
int hashCode ()
String name ()
String symbol ()
String toString ()

Additional Inherited Members

Protected Member Functions inherited from org.wpilib.units.Unit
 Unit (Unit baseUnit, UnaryFunction toBaseConverter, UnaryFunction fromBaseConverter, String name, String symbol)
 Unit (Unit baseUnit, double baseUnitEquivalent, String name, String symbol)

Detailed Description

Unit of mass dimension.

This is the base type for units of mass dimension. It is also used to specify the dimension for the mass-specific Mass measurement type.

Actual units (such as Units#Grams and Units#Pounds) can be found in the Units class.

Definition at line 18 of file MassUnit.java.

Member Function Documentation

◆ convertFrom()

double org.wpilib.units.MassUnit.convertFrom ( double magnitude,
MassUnit otherUnit )

Converts a measurement value in terms of another mass unit to this unit.

Parameters
magnitudethe magnitude of the measurement in terms of the other mass unit
otherUnitthe other mass unit
Returns
the value of the measurement in terms of this unit

Definition at line 81 of file MassUnit.java.

◆ getBaseUnit()

MassUnit org.wpilib.units.MassUnit.getBaseUnit ( )

Gets the base unit of measurement that this unit is derived from. If the unit is the base unit, the unit will be returned.

NOTE: Subclasses must override this method to provide the correct return type. Failing to do say will make unit combinations that use it break at runtime!


  Unit baseUnit = new Unit(null, ...);
  baseUnit.getBaseUnit(); // returns baseUnit

  Unit derivedUnit = new Unit(baseUnit, ...);
  derivedUnit.getBaseUnit(); // returns baseUnit
Returns
the base unit

Reimplemented from org.wpilib.units.Unit.

Definition at line 34 of file MassUnit.java.

◆ mult() [1/2]

ForceUnit org.wpilib.units.MassUnit.mult ( LinearAccelerationUnit acceleration)

Multiplies this mass unit by a unit of linear acceleration to form a combined unit of force.

Parameters
accelerationthe unit of acceleration
Returns
the combined unit of force

Definition at line 102 of file MassUnit.java.

◆ mult() [2/2]

LinearMomentumUnit org.wpilib.units.MassUnit.mult ( LinearVelocityUnit velocity)

Multiplies this mass unit by a unit of linear velocity to form a combined unit of linear momentum.

Parameters
velocitythe unit of velocity
Returns
the combined unit of momentum

Definition at line 92 of file MassUnit.java.

◆ of()

Mass org.wpilib.units.MassUnit.of ( double magnitude)

Creates a new immutable measurement of the given magnitude in terms of this unit. Implementations are strongly recommended to sharpen the return type to a unit-specific measurement implementation.

Parameters
magnitudethe magnitude of the measurement.
Returns
the measurement object

Reimplemented from org.wpilib.units.Unit.

Definition at line 39 of file MassUnit.java.

◆ ofBaseUnits()

Mass org.wpilib.units.MassUnit.ofBaseUnits ( double baseUnitMagnitude)

Creates a new immutable measurement of the given magnitude in terms of this unit's base unit. Implementations are strongly recommended to sharpen the return type to a unit-specific measurement implementation.

Parameters
baseUnitMagnitudethe magnitude in terms of the base unit
Returns
the measurement object

Reimplemented from org.wpilib.units.Unit.

Definition at line 44 of file MassUnit.java.

◆ one()

Mass org.wpilib.units.MassUnit.one ( )

Gets a measure with a magnitude of 1.0 in terms of this unit. The returned object is guaranteed to be of the same type returned by of(double). Subclasses are encouraged to override this method to sharpen the return type.

Returns
a measure of magnitude 1.0 in terms of this unit

Reimplemented from org.wpilib.units.Unit.

Definition at line 54 of file MassUnit.java.

◆ per()

VelocityUnit< MassUnit > org.wpilib.units.MassUnit.per ( TimeUnit time)

Combines this unit with a unit of time. This often - but not always - results in a velocity. Subclasses should sharpen the return type to be unit-specific.

Parameters
timethe unit of time
Returns
the combined unit

Reimplemented from org.wpilib.units.Unit.

Definition at line 59 of file MassUnit.java.

◆ zero()

Mass org.wpilib.units.MassUnit.zero ( )

Gets a measure of zero magnitude in terms of this unit. The returned object is guaranteed to be of the same type returned by of(double). Subclasses are encouraged to override this method to sharpen the return type.

Returns
a zero-magnitude measure of this unit

Reimplemented from org.wpilib.units.Unit.

Definition at line 49 of file MassUnit.java.


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