mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
SCRIPT Move java files
This commit is contained in:
committed by
Peter Johnson
parent
7ca1be9bae
commit
c350c5f112
43
wpiunits/src/test/java/org/wpilib/units/ExampleUnit.java
Normal file
43
wpiunits/src/test/java/org/wpilib/units/ExampleUnit.java
Normal file
@@ -0,0 +1,43 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
package edu.wpi.first.units;
|
||||
|
||||
class ExampleUnit extends Unit {
|
||||
ExampleUnit(double baseUnitEquivalent) {
|
||||
this(baseUnitEquivalent, "Example", "ex");
|
||||
}
|
||||
|
||||
ExampleUnit(
|
||||
ExampleUnit baseUnit,
|
||||
UnaryFunction toBase,
|
||||
UnaryFunction fromBase,
|
||||
String name,
|
||||
String symbol) {
|
||||
super(baseUnit, toBase, fromBase, name, symbol);
|
||||
}
|
||||
|
||||
ExampleUnit(double baseUnitEquivalent, String name, String symbol) {
|
||||
super(null, baseUnitEquivalent, name, symbol);
|
||||
}
|
||||
|
||||
public double convertFrom(double magnitude, ExampleUnit otherUnit) {
|
||||
return fromBaseUnits(otherUnit.toBaseUnits(magnitude));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Measure<ExampleUnit> of(double magnitude) {
|
||||
return ImmutableMeasure.ofRelativeUnits(magnitude, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Measure<ExampleUnit> ofBaseUnits(double baseUnitMagnitude) {
|
||||
return ImmutableMeasure.ofBaseUnits(baseUnitMagnitude, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VelocityUnit<ExampleUnit> per(TimeUnit time) {
|
||||
return VelocityUnit.combine(this, time);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user