Class EnergyTotal

Object
EnergyTotal
All Implemented Interfaces:
Serializable

public class EnergyTotal extends Object implements Serializable
Represents the total energy of a system, which can be modified and queried.

This class is serializable and provides methods for deep copying, adding energy, and retrieving the total energy.

See Also:
  • Constructor Details

    • EnergyTotal

      public EnergyTotal(double total)
      Creates a new EnergyTotal instance.
      Parameters:
      total - The total energy value.
    • EnergyTotal

      public EnergyTotal()
  • Method Details

    • deepCopy

      public EnergyTotal deepCopy()
      Creates a deep copy of this EnergyTotal instance.
      Returns:
      a new EnergyTotal instance with the same total energy value
    • add

      public final void add(double val)
      Adds a value to the total energy.
      Parameters:
      val - the value to add to the total energy
    • getTotal

      public final double getTotal()
      Gets the current total energy value.
      Returns:
      the total energy as a double
    • toString

      public String toString()
      Overrides:
      toString in class Object