Class EnergySavedPairs
Object
EnergySavedPairs
- All Implemented Interfaces:
UpdatableMarks
Stores and manages pairwise energy interactions between marks.
This class implements UpdatableMarks
to allow for dynamic updates of mark pairs and
their energies.
-
Constructor Summary
ConstructorsConstructorDescriptionEnergySavedPairs
(AddCriteria<EnergyPair> addCriteria) Creates a new instance with the specified add criteria for energy pairs. -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(MemoForIndex pxlMarkMemoList, VoxelizedMarkMemo newMark) Adds a new mark to the existing set of marks.void
Asserts that the total energy is valid (not NaN).Creates a set of unique energy pairs.deepCopy()
Creates a deep copy of this instance.void
exchange
(MemoForIndex memo, VoxelizedMarkMemo oldMark, int indexOldMark, VoxelizedMarkMemo newMark) Exchanges an existing mark with a new one.double
Pairwise energy totalvoid
initUpdatableMarks
(MemoForIndex pxlMarkMemoList, EnergyStack stack, Logger logger, SharedFeatures sharedFeatures) Initializes the updatable marks with necessary context.boolean
isMarksSpan
(MarkCollection marks) Checks if the pair collection only contains items from a particular mark configuration.void
remove
(MemoForIndex marksExisting, VoxelizedMarkMemo mark) Removes a mark from the existing set of marks.Creates a shallow copy of this instance.toString()
-
Constructor Details
-
EnergySavedPairs
Creates a new instance with the specified add criteria for energy pairs.- Parameters:
addCriteria
- theAddCriteria
forEnergyPair
s
-
-
Method Details
-
shallowCopy
Creates a shallow copy of this instance.- Returns:
- a new
EnergySavedPairs
with a shallow copy of the pair collection
-
deepCopy
Creates a deep copy of this instance.- Returns:
- a new
EnergySavedPairs
with a deep copy of the pair collection
-
add
public void add(MemoForIndex pxlMarkMemoList, VoxelizedMarkMemo newMark) throws UpdateMarkSetException Description copied from interface:UpdatableMarks
Adds a new mark to the existing set of marks.- Specified by:
add
in interfaceUpdatableMarks
- Parameters:
pxlMarkMemoList
- the existing set of marksnewMark
- the new mark to be added- Throws:
UpdateMarkSetException
- if the addition operation fails
-
remove
public void remove(MemoForIndex marksExisting, VoxelizedMarkMemo mark) throws UpdateMarkSetException Description copied from interface:UpdatableMarks
Removes a mark from the existing set of marks.- Specified by:
remove
in interfaceUpdatableMarks
- Parameters:
marksExisting
- the existing set of marksmark
- the mark to be removed- Throws:
UpdateMarkSetException
- if the removal operation fails
-
exchange
public void exchange(MemoForIndex memo, VoxelizedMarkMemo oldMark, int indexOldMark, VoxelizedMarkMemo newMark) throws UpdateMarkSetException Description copied from interface:UpdatableMarks
Exchanges an existing mark with a new one.- Specified by:
exchange
in interfaceUpdatableMarks
- Parameters:
memo
- the memo for indexingoldMark
- the mark to be replacedindexOldMark
- the index of the old marknewMark
- the new mark to replace the old one- Throws:
UpdateMarkSetException
- if the exchange operation fails
-
isMarksSpan
Checks if the pair collection only contains items from a particular mark configuration.- Parameters:
marks
- theMarkCollection
to check against- Returns:
- true if the pair collection only contains marks from the given collection, false otherwise
-
toString
-
assertValid
public void assertValid()Asserts that the total energy is valid (not NaN). -
createPairsUnique
Creates a set of unique energy pairs.- Returns:
- a
Set
of uniqueEnergyPair
s
-
getEnergyTotal
public double getEnergyTotal()Pairwise energy total
-