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 TypeMethodDescriptionvoidadd(MemoForIndex pxlMarkMemoList, VoxelizedMarkMemo newMark) Adds a new mark to the existing set of marks.voidAsserts that the total energy is valid (not NaN).Creates a set of unique energy pairs.deepCopy()Creates a deep copy of this instance.voidexchange(MemoForIndex memo, VoxelizedMarkMemo oldMark, int indexOldMark, VoxelizedMarkMemo newMark) Exchanges an existing mark with a new one.doublePairwise energy totalvoidinitUpdatableMarks(MemoForIndex pxlMarkMemoList, EnergyStack stack, Logger logger, SharedFeatures sharedFeatures) Initializes the updatable marks with necessary context.booleanisMarksSpan(MarkCollection marks) Checks if the pair collection only contains items from a particular mark configuration.voidremove(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- theAddCriteriaforEnergyPairs
-
-
Method Details
-
shallowCopy
Creates a shallow copy of this instance.- Returns:
- a new
EnergySavedPairswith a shallow copy of the pair collection
-
deepCopy
Creates a deep copy of this instance.- Returns:
- a new
EnergySavedPairswith a deep copy of the pair collection
-
add
public void add(MemoForIndex pxlMarkMemoList, VoxelizedMarkMemo newMark) throws UpdateMarkSetException Description copied from interface:UpdatableMarksAdds a new mark to the existing set of marks.- Specified by:
addin 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:UpdatableMarksRemoves a mark from the existing set of marks.- Specified by:
removein 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:UpdatableMarksExchanges an existing mark with a new one.- Specified by:
exchangein 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- theMarkCollectionto 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
Setof uniqueEnergyPairs
-
getEnergyTotal
public double getEnergyTotal()Pairwise energy total
-