public class AdditionMove extends AbstractSubsetMove
Constructor and Description |
---|
AdditionMove(int add)
Create a new addition move that will add the specified ID to the current
selection when being applied to a given subset solution.
|
Modifier and Type | Method and Description |
---|---|
void |
apply(SubsetSolution solution)
Apply this addition move to the given subset solution.
|
int |
getAddedID()
Returns the added ID.
|
Set<Integer> |
getAddedIDs()
Returns an unmodifiable singleton containing the only added ID.
|
Set<Integer> |
getDeletedIDs()
Returns an unmodifiable empty set, as no IDs are deleted by this move.
|
int |
getNumAdded()
Always return 1, as a single ID is added.
|
int |
getNumDeleted()
Always returns 0, as no IDs are deleted.
|
void |
undo(SubsetSolution solution)
Undo this addition move after it has been successfully applied to the given subset solution, by removing the newly added ID
from the selection.
|
equals, hashCode
public AdditionMove(int add)
add
- ID to add to selectionpublic Set<Integer> getAddedIDs()
public int getAddedID()
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 is appliedSolutionModificationException
- if the added ID is currently already selected or does not correspond to an entitypublic void undo(SubsetSolution solution)
solution
- solution to which the move has been appliedCopyright © 2016. All rights reserved.