mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +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:
@@ -5,8 +5,6 @@
|
||||
package edu.wpi.first.units;
|
||||
|
||||
import edu.wpi.first.units.measure.Current;
|
||||
import edu.wpi.first.units.measure.ImmutableCurrent;
|
||||
import edu.wpi.first.units.measure.MutCurrent;
|
||||
|
||||
/**
|
||||
* Unit of electric current dimension.
|
||||
@@ -53,12 +51,12 @@ public final class CurrentUnit extends Unit {
|
||||
|
||||
@Override
|
||||
public Current of(double magnitude) {
|
||||
return new ImmutableCurrent(magnitude, toBaseUnits(magnitude), this);
|
||||
return new Current(magnitude, toBaseUnits(magnitude), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Current ofBaseUnits(double baseUnitMagnitude) {
|
||||
return new ImmutableCurrent(fromBaseUnits(baseUnitMagnitude), baseUnitMagnitude, this);
|
||||
return new Current(fromBaseUnits(baseUnitMagnitude), baseUnitMagnitude, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -71,11 +69,6 @@ public final class CurrentUnit extends Unit {
|
||||
return (Current) super.one();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MutCurrent mutable(double initialMagnitude) {
|
||||
return new MutCurrent(initialMagnitude, toBaseUnits(initialMagnitude), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VelocityUnit<CurrentUnit> per(TimeUnit time) {
|
||||
return VelocityUnit.combine(this, time);
|
||||
|
||||
Reference in New Issue
Block a user