package com.easternedgerobotics.rov.value;

import java.util.Objects;

public class SpeedValue implements MutableValueCompanion<Speed> {
    /**
     * Creates a SpeedValue with the given name.
     *
     * @param name the logical name of the thruster
     * @return a SpeedValue
     */
    public static SpeedValue zero(final String name) {
        return create(name, 0);
    }

    /**
     * Creates a SpeedValue with the given name and speed.
     *
     * @param name the logical name of the thruster.
     * @param speed the speed of the thruster.
     * @return a SpeedValue
     */
    public static SpeedValue create(final String name, final float speed) {
        final Speed thruster = new Speed();
        thruster.name = name;
        thruster.speed = speed;
        return new SpeedValue(thruster);
    }

    private final Speed thruster;

    SpeedValue(final Speed thruster) {
        this.thruster = thruster;
    }

    public final SpeedValue setSpeed(
        final float speed
    ) {
        return SpeedValue.create(
            thruster.name,
            speed
        );
    }

    public final String getName() {
        return thruster.name;
    }

    public final float getSpeed() {
        return thruster.speed;
    }

    @Override
    public final Speed asMutable() {
        return thruster;
    }

    @Override
    public final String toString() {
        return String.format(
            "Speed={%s, %f}",
            thruster.name,
            thruster.speed
        );
    }

    @Override
    public final boolean equals(final Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        final SpeedValue that = (SpeedValue) o;
        return Objects.equals(thruster, that.thruster);
    }

    @Override
    public final int hashCode() {
        return Objects.hash(thruster);
    }
}

@@ -237,24 +237,22 @@
  of the 
-thruster
+device
 %0A     * 
@@ -253,32 +253,37 @@
     * @return a 
+zero 
 SpeedValue%0A     
@@ -492,33 +492,30 @@
 name of the 
-thruster.
+device
 %0A     * @par
@@ -540,25 +540,22 @@
  of the 
-thruster.
+device
 %0A     * 
@@ -679,24 +679,22 @@
 l Speed 
-thruster
+device
  = new S
@@ -705,32 +705,30 @@
 ();%0A        
-thruster
+device
 .name = name
@@ -733,32 +733,30 @@
 me;%0A        
-thruster
+device
 .speed = spe
@@ -789,24 +789,22 @@
 edValue(
-thruster
+device
 );%0A    %7D
@@ -829,24 +829,22 @@
 l Speed 
-thruster
+device
 ;%0A%0A    S
@@ -865,24 +865,22 @@
 l Speed 
-thruster
+device
 ) %7B%0A    
@@ -892,27 +892,23 @@
 his.
-thruster = thruster
+device = device
 ;%0A  
@@ -1026,32 +1026,30 @@
             
-thruster
+device
 .name,%0A     
@@ -1130,24 +1130,22 @@
  return 
-thruster
+device
 .name;%0A 
@@ -1201,24 +1201,22 @@
  return 
-thruster
+device
 .speed;%0A
@@ -1288,24 +1288,22 @@
  return 
-thruster
+device
 ;%0A    %7D%0A
@@ -1426,24 +1426,22 @@
         
-thruster
+device
 .name,%0A 
@@ -1451,24 +1451,22 @@
         
-thruster
+device
 .speed%0A 
@@ -1779,31 +1779,27 @@
 als(
-thruster, that.thruster
+device, that.device
 );%0A 
@@ -1884,16 +1884,14 @@
 ash(
-thruster
+device
 );%0A 

Replace all instances of the word thruster with device in SpeedValue