public class ReverseSubsequenceMove extends Object implements org.jamesframework.core.search.neigh.Move<PermutationSolution>
Constructor and Description |
---|
ReverseSubsequenceMove(int from,
int to)
Create a move that will reverse the subsequence from one up to another position in the permutation.
|
Modifier and Type | Method and Description |
---|---|
void |
apply(PermutationSolution solution)
Reverse the subsequence by performing a series of swaps in the given permutation solution.
|
boolean |
equals(Object obj)
Two moves of this type are considered equals if they reverse the same subsequence.
|
int |
getFrom()
Get the first position in the reversed subsequence.
|
int |
getTo()
Get the last position in the reversed subsequence.
|
int |
hashCode()
Hash code computation corresponding to implementation of
equals(Object) . |
void |
undo(PermutationSolution solution)
Undo move by reverting the order of the reversed subsequence.
|
public ReverseSubsequenceMove(int from, int to)
from
is larger than to
as the first item is cyclically
defined as the successor of the last item. Yet, both positions should be different.from
- first position of reversed subsequenceto
- last position of reversed subsequenceIllegalArgumentException
- if from
and to
are equalpublic int getFrom()
public int getTo()
public void apply(PermutationSolution solution)
apply
in interface org.jamesframework.core.search.neigh.Move<PermutationSolution>
solution
- permutation solution to which the move is to be appliedpublic void undo(PermutationSolution solution)
undo
in interface org.jamesframework.core.search.neigh.Move<PermutationSolution>
solution
- permutation solution to which the move had been appliedpublic boolean equals(Object obj)
public int hashCode()
equals(Object)
.Copyright © 2015. All rights reserved.