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.voidclean()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.intGets 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.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()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:MemoForIndexReturns the total number of memos available.- Specified by:
sizein 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
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
-
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
-