Class EnergySavedIndividual
Object
org.anchoranalysis.mpp.feature.energy.saved.EnergySavedIndividual
- All Implemented Interfaces:
Serializable,Iterable<EnergyTotal>
public class EnergySavedIndividual extends Object implements Serializable, Iterable<EnergyTotal>
Stores and manages individual energy values for a collection of marks.
This class implements Serializable for persistence and Iterable for easy
iteration over energy values.
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description EnergySavedIndividual() -
Method Summary
Modifier and Type Method Description voidadd(EnergyTotal item)Adds a new energy total to the list and updates the total energy.voidassertValid()Asserts that the total energy is valid (not NaN).EnergySavedIndividualdeepCopy()Creates a deep copy of this instance.StringdescribeMarks(MarkCollection marks)Generates a string description of the marks and their associated energies.voidexchange(int index, EnergyTotal item)Exchanges an energy total at a specific index with a new one and updates the total energy.EnergyTotalget(int index)Gets the energy total at a specific index.doublegetEnergyTotal()The total energy of all individual marks.Iterator<EnergyTotal>iterator()voidresetInd()Resets the list of individual energy totals.voidrmv(int index)Removes an energy total at a specific index and updates the total energy.voidsetEnergyTotal(double energyTotal)The total energy of all individual marks.EnergySavedIndividualshallowCopy()Creates a shallow copy of this instance.intsize()Gets the number of individual energy totals stored.
-
Constructor Details
-
EnergySavedIndividual
public EnergySavedIndividual()
-
-
Method Details
-
shallowCopy
Creates a shallow copy of this instance.- Returns:
- a new
EnergySavedIndividualwith a shallow copy of the energy totals
-
deepCopy
Creates a deep copy of this instance.- Returns:
- a new
EnergySavedIndividualwith a deep copy of the energy totals
-
size
public int size()Gets the number of individual energy totals stored.- Returns:
- the number of energy totals
-
get
Gets the energy total at a specific index.- Parameters:
index- the index of the energy total to retrieve- Returns:
- the
EnergyTotalat the specified index
-
resetInd
public void resetInd()Resets the list of individual energy totals. -
add
Adds a new energy total to the list and updates the total energy.- Parameters:
item- theEnergyTotalto add
-
rmv
public void rmv(int index)Removes an energy total at a specific index and updates the total energy.- Parameters:
index- the index of the energy total to remove
-
exchange
Exchanges an energy total at a specific index with a new one and updates the total energy.- Parameters:
index- the index of the energy total to exchangeitem- the newEnergyTotalto replace the existing one
-
describeMarks
Generates a string description of the marks and their associated energies.- Parameters:
marks- theMarkCollectioncontaining the marks- Returns:
- a string representation of the marks and their energies
-
assertValid
public void assertValid()Asserts that the total energy is valid (not NaN). -
iterator
- Specified by:
iteratorin interfaceIterable<EnergyTotal>
-
getEnergyTotal
public double getEnergyTotal()The total energy of all individual marks. -
setEnergyTotal
public void setEnergyTotal(double energyTotal)The total energy of all individual marks.
-