public class GeneralSubsetMove extends AbstractSubsetMove
Constructor and Description |
---|
GeneralSubsetMove(Set<Integer> add,
Set<Integer> delete)
Creates a general subset move, indicating which IDs are to be added to and deleted from
the current selection when being applied to a given subset solution.
|
Modifier and Type | Method and Description |
---|---|
void |
apply(SubsetSolution solution)
Apply this move to a given subset solution.
|
Set<Integer> |
getAddedIDs()
Returns an unmodifiable view of the set of IDs added to the selection when applying
this move to a subset solution.
|
Set<Integer> |
getDeletedIDs()
Returns an unmodifiable view of the set of IDs removed from the selection when applying
this move to a subset solution.
|
int |
getNumAdded()
Returns the number of added IDs.
|
int |
getNumDeleted()
Returns the number of removed IDs.
|
void |
undo(SubsetSolution solution)
Undo this move after it has been successfully applied to the given subset solution,
by removing all added IDs and adding all removed IDs.
|
equals, hashCode
public GeneralSubsetMove(Set<Integer> add, Set<Integer> delete)
add
and delete
are not copied: a reference to the given
sets is stored in the subset move. If any of both sets is null
, it will be
replaced with an empty set.add
- set of IDs to add to the selectiondelete
- set of IDs to delete from the selectionpublic Set<Integer> getAddedIDs()
public Set<Integer> getDeletedIDs()
public int getNumAdded()
public int getNumDeleted()
public void apply(SubsetSolution solution)
undo(SubsetSolution)
will correctly undo the move.solution
- solution to which to move will be appliedSolutionModificationException
- if some added ID is already selected, some removed ID is currently
not selected, or any ID does not correspond to an underlying entitypublic void undo(SubsetSolution solution)
solution
- solution to which the move has been successfully appliedCopyright © 2016. All rights reserved.