public class PermutationSolution extends Solution
| Constructor and Description |
|---|
PermutationSolution(List<Integer> order)
Creates a order solution.
|
| Modifier and Type | Method and Description |
|---|---|
PermutationSolution |
copy()
Creates a deep copy of this permutation solution with the same order of IDs.
|
boolean |
equals(Object other)
Checks whether the given other object is also a permutation solution consisting
of the same IDs in exactly the same order.
|
List<Integer> |
getOrder()
Get an unmodifiable view of the current order of IDs.
|
int |
hashCode()
Hash code computation corresponding to the implementation of
equals(Object). |
int |
size()
Get the number of items in this permutation.
|
void |
swap(int i,
int j)
Swap the items at position i and j in the permutation.
|
String |
toString()
Create a string representation of the permutation solution,
indicating the current order of IDs.
|
checkedCopypublic PermutationSolution(List<Integer> order)
order - ordered IDsIllegalArgumentException - if order is empty or contains duplicatesNullPointerException - if order is null or contains
any null elementspublic List<Integer> getOrder()
public int size()
public void swap(int i,
int j)
i - position of first item to be swappedj - position of second item to be swappedSolutionModificationException - if i or j is
= * negative, or larger than or equal to the
number of items in the permutationpublic PermutationSolution copy()
public boolean equals(Object other)
public int hashCode()
equals(Object).Copyright © 2016. All rights reserved.