Class EnergyMemoList
Object
EnergyMemoList
- All Implemented Interfaces:
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:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates 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 TypeMethodDescriptionadd
(EnergySavedIndividual energySavedInd, VoxelizedMarkMemo memo, EnergyStackWithoutParameters stack, EnergySchemeWithSharedFeatures energyScheme) Adds a new mark to the list and calculates its energy.asMarks()
Converts the energy memo list to a collection of marks.void
clean()
Cleans up the energy memo list by setting the list to null.exchange
(EnergySavedIndividual energySavedInd, int index, VoxelizedMarkMemo newMark, EnergyStackWithoutParameters stack, EnergySchemeWithSharedFeatures energySchemeTotal) Exchanges a mark at a specific index with a new mark and recalculates energies.int
Gets the index for a specific memo.getMemoForIndex
(int index) Gets the memo for a specific index.getMemoForMark
(MarkCollection marks, Mark mark) Gets the memo for a specific mark in the collection.Gets the region map associated with this energy memo list.void
remove
(EnergySavedIndividual energySavedInd, int index) Removes a mark at a specific index and updates energies.void
removeTwo
(EnergySavedIndividual energySavedInd, int index1, int index2) Removes two marks at specific indices and updates energies.int
size()
Returns the total number of memos available.
-
Constructor Details
-
EnergyMemoList
public EnergyMemoList()Creates an empty energy memo list. -
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()Description copied from interface:MemoForIndex
Returns the total number of memos available.- Specified by:
size
in interfaceMemoForIndex
- Returns:
- the number of memos, always non-negative
-
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
VoxelizedMarkMemo
for the given mark - Throws:
AnchorFriendlyRuntimeException
- if the mark doesn't exist in the collection
-
getMemoForIndex
Gets the memo for a specific index.- Specified by:
getMemoForIndex
in interfaceMemoForIndex
- Parameters:
index
- the index of the memo- Returns:
- the
VoxelizedMarkMemo
at 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
-
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
MarkCollection
containing all the marks in this list
-