package com.easternedgerobotics.rov.value;

import java.util.Objects;

public class CpuValue implements MutableValueCompanion<Cpu> {
    /**
     * Constructs a CPU value with the given frequency, temperature, and voltage.
     *
     * @param frequency the ARM clock frequency.
     * @param temperature The core temperature of the main SoC in celsius.
     * @param voltage the core voltage.
     * @return a CPU value with the given frequency, temperature, and voltage.
     */
    public static CpuValue create(final long frequency, final float temperature, final float voltage) {
        final Cpu cpu = new Cpu();
        cpu.frequency = frequency;
        cpu.temperature = temperature;
        cpu.voltage = voltage;
        return new CpuValue(cpu);
    }

    private final Cpu cpu;

    CpuValue(final Cpu cpu) {
        this.cpu = cpu;
    }

    @Override
    public final Cpu asMutable() {
        return cpu;
    }

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

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

    @Override
    public final String toString() {
        return String.format(
            "CpuValue{frequency=%d, temperature=%f, voltage=%f}",
            cpu.frequency,
            cpu.temperature,
            cpu.voltage
        );
    }
}

@@ -840,32 +840,262 @@
 u = cpu;%0A    %7D%0A%0A
+    public final long getFrequency() %7B%0A        return cpu.frequency;%0A    %7D%0A%0A    public final float getTemperature() %7B%0A        return cpu.temperature;%0A    %7D%0A%0A    public final float getVoltage() %7B%0A        return cpu.voltage;%0A    %7D%0A%0A
     @Override%0A  

Add accessor methods to CpuValue