mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[docs] Add wpiunits to JavaDocs (#5793)
Co-authored-by: Sam Carlberg <sam.carlberg@gmail.com>
This commit is contained in:
@@ -85,12 +85,13 @@ public class Unit<U extends Unit<U>> {
|
||||
* this unit.
|
||||
*
|
||||
* <pre>
|
||||
* Inches.convertFrom(12, Feet) // => 144.0
|
||||
* Kilograms.convertFrom(2.2, Pounds) // => 0.9979024
|
||||
* Inches.convertFrom(12, Feet) // 144.0
|
||||
* Kilograms.convertFrom(2.2, Pounds) // 0.9979024
|
||||
* </pre>
|
||||
*
|
||||
* @param magnitude a magnitude measured in another unit
|
||||
* @param otherUnit the unit to convert the magnitude to
|
||||
* @return the corresponding value in terms of this unit.
|
||||
*/
|
||||
public double convertFrom(double magnitude, Unit<U> otherUnit) {
|
||||
if (this.equivalent(otherUnit)) {
|
||||
@@ -125,6 +126,7 @@ public class Unit<U extends Unit<U>> {
|
||||
* <i>immutable</i> and cannot have its value modified.
|
||||
*
|
||||
* @param magnitude the magnitude of the measure to create
|
||||
* @return the measure
|
||||
*/
|
||||
public Measure<U> of(double magnitude) {
|
||||
if (magnitude == 0) {
|
||||
@@ -180,8 +182,8 @@ public class Unit<U extends Unit<U>> {
|
||||
* jerk, etc.
|
||||
*
|
||||
* <pre>
|
||||
* Meters.per(Second) // => linear velocity
|
||||
* Kilograms.per(Second) // => mass flow
|
||||
* Meters.per(Second) // linear velocity
|
||||
* Kilograms.per(Second) // mass flow
|
||||
* Feet.per(Second).per(Second).of(32) // roughly 1G of acceleration
|
||||
* </pre>
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user