Class EnergyTotal
Object
EnergyTotal
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal void
add
(double val) Adds a value to the total energy.deepCopy()
Creates a deep copy of thisEnergyTotal
instance.final double
getTotal()
Gets the current total energy value.toString()
-
Constructor Details
-
EnergyTotal
public EnergyTotal(double total) Creates a newEnergyTotal
instance.- Parameters:
total
- The total energy value.
-
EnergyTotal
public EnergyTotal()
-
-
Method Details
-
deepCopy
Creates a deep copy of thisEnergyTotal
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
-