mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-29 02:21:44 +00:00
[wpiunits] Make Java units immutable only (#8115)
Remove mutable implementations, as systemcore doesn't need mutability to keep performance under control.
This commit is contained in:
@@ -4,8 +4,6 @@
|
||||
|
||||
package edu.wpi.first.units;
|
||||
|
||||
import edu.wpi.first.units.measure.ImmutableVelocity;
|
||||
import edu.wpi.first.units.measure.MutVelocity;
|
||||
import edu.wpi.first.units.measure.Velocity;
|
||||
|
||||
/**
|
||||
@@ -80,12 +78,12 @@ public final class VelocityUnit<D extends Unit> extends PerUnit<D, TimeUnit> {
|
||||
|
||||
@Override
|
||||
public Velocity<D> of(double magnitude) {
|
||||
return new ImmutableVelocity<>(magnitude, toBaseUnits(magnitude), this);
|
||||
return new Velocity<>(magnitude, toBaseUnits(magnitude), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Velocity<D> ofBaseUnits(double baseUnitMagnitude) {
|
||||
return new ImmutableVelocity<>(fromBaseUnits(baseUnitMagnitude), baseUnitMagnitude, this);
|
||||
return new Velocity<>(fromBaseUnits(baseUnitMagnitude), baseUnitMagnitude, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -100,11 +98,6 @@ public final class VelocityUnit<D extends Unit> extends PerUnit<D, TimeUnit> {
|
||||
return (Velocity<D>) super.one();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MutableMeasure<VelocityUnit<D>, ?, ?> mutable(double initialMagnitude) {
|
||||
return new MutVelocity<>(initialMagnitude, toBaseUnits(initialMagnitude), this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Combines this velocity unit with a unit of a period of change to create an acceleration unit.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user