Class EnergyMemoList
Object
org.anchoranalysis.mpp.feature.mark.EnergyMemoList
- All Implemented Interfaces:
Serializable,MemoForIndex
public class EnergyMemoList extends Object implements Serializable, MemoForIndex
A collection of memoized marks on which energies can be derived.
This class implements Serializable for persistence and MemoForIndex for
indexing operations.
- Author:
- Owen Feehan
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description EnergyMemoList()Creates an empty energy memo list.EnergyMemoList(EnergySavedIndividual savedInd, EnergyStackWithoutParameters energyStack, MarkCollection marks, EnergySchemeWithSharedFeatures energySchemeTotal)Creates an energy memo list with the given parameters.EnergyMemoList(EnergyMemoList source)Creates a copy of an existing energy memo list. -
Method Summary
Modifier and Type Method Description VoxelizedMarkMemoadd(EnergySavedIndividual energySavedInd, VoxelizedMarkMemo memo, EnergyStackWithoutParameters stack, EnergySchemeWithSharedFeatures energyScheme)Adds a new mark to the list and calculates its energy.MarkCollectionasMarks()Converts the energy memo list to a collection of marks.voidclean()Cleans up the energy memo list by setting the list to null.VoxelizedMarkMemoexchange(EnergySavedIndividual energySavedInd, int index, VoxelizedMarkMemo newMark, EnergyStackWithoutParameters stack, EnergySchemeWithSharedFeatures energySchemeTotal)Exchanges a mark at a specific index with a new mark and recalculates energies.intgetIndexForMemo(VoxelizedMarkMemo memo)Gets the index for a specific memo.VoxelizedMarkMemogetMemoForIndex(int index)Gets the memo for a specific index.VoxelizedMarkMemogetMemoForMark(MarkCollection marks, Mark mark)Gets the memo for a specific mark in the collection.RegionMapgetRegionMap()Gets the region map associated with this energy memo list.voidremove(EnergySavedIndividual energySavedInd, int index)Removes a mark at a specific index and updates energies.voidremoveTwo(EnergySavedIndividual energySavedInd, int index1, int index2)Removes two marks at specific indices and updates energies.intsize()
-
Constructor Details
-
EnergyMemoList
public EnergyMemoList()Creates an empty energy memo list. -
EnergyMemoList
public EnergyMemoList(EnergySavedIndividual savedInd, EnergyStackWithoutParameters energyStack, MarkCollection marks, EnergySchemeWithSharedFeatures energySchemeTotal) throws NamedFeatureCalculateExceptionCreates an energy memo list with the given parameters.- Parameters:
savedInd- the saved individual energiesenergyStack- the energy stack without parametersmarks- the collection of marksenergySchemeTotal- the energy scheme with shared features- Throws:
NamedFeatureCalculateException- if there's an error calculating named features
-
EnergyMemoList
Creates a copy of an existing energy memo list.- Parameters:
source- the source energy memo list to copy
-
-
Method Details
-
clean
public void clean()Cleans up the energy memo list by setting the list to null. -
size
public int size()- Specified by:
sizein interfaceMemoForIndex
-
getRegionMap
Gets the region map associated with this energy memo list.- Returns:
- the
RegionMap
-
getMemoForMark
Gets the memo for a specific mark in the collection.- Parameters:
marks- the collection of marksmark- the specific mark to find- Returns:
- the
VoxelizedMarkMemofor the given mark - Throws:
AnchorFriendlyRuntimeException- if the mark doesn't exist in the collection
-
getMemoForIndex
Gets the memo for a specific index.- Specified by:
getMemoForIndexin interfaceMemoForIndex- Parameters:
index- the index of the memo- Returns:
- the
VoxelizedMarkMemoat the given index
-
getIndexForMemo
Gets the index for a specific memo.- Parameters:
memo- the memo to find- Returns:
- the index of the memo, or -1 if not found
-
exchange
public VoxelizedMarkMemo exchange(EnergySavedIndividual energySavedInd, int index, VoxelizedMarkMemo newMark, EnergyStackWithoutParameters stack, EnergySchemeWithSharedFeatures energySchemeTotal) throws NamedFeatureCalculateExceptionExchanges a mark at a specific index with a new mark and recalculates energies.- Parameters:
energySavedInd- the saved individual energiesindex- the index of the mark to exchangenewMark- the new mark to insertstack- the energy stack without parametersenergySchemeTotal- the energy scheme with shared features- Returns:
- the
VoxelizedMarkMemofor the new mark - Throws:
NamedFeatureCalculateException- if there's an error calculating named features
-
add
public VoxelizedMarkMemo add(EnergySavedIndividual energySavedInd, VoxelizedMarkMemo memo, EnergyStackWithoutParameters stack, EnergySchemeWithSharedFeatures energyScheme) throws NamedFeatureCalculateExceptionAdds a new mark to the list and calculates its energy.- Parameters:
energySavedInd- the saved individual energiesmemo- the memo for the new markstack- the energy stack without parametersenergyScheme- the energy scheme with shared features- Returns:
- the
VoxelizedMarkMemofor the added mark - Throws:
NamedFeatureCalculateException- if there's an error calculating named features
-
remove
Removes a mark at a specific index and updates energies.- Parameters:
energySavedInd- the saved individual energiesindex- the index of the mark to remove
-
removeTwo
Removes two marks at specific indices and updates energies.- Parameters:
energySavedInd- the saved individual energiesindex1- the index of the first mark to removeindex2- the index of the second mark to remove
-
asMarks
Converts the energy memo list to a collection of marks.- Returns:
- a
MarkCollectioncontaining all the marks in this list
-