public class PermutationSolution
extends org.jamesframework.core.problems.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.
|
public 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 swappedorg.jamesframework.core.exceptions.SolutionModificationException
- if i
and j
are equal or one of both arguments is
negative or larger than or equal to the
number of items in the permutationpublic PermutationSolution copy()
copy
in class org.jamesframework.core.problems.Solution
public boolean equals(Object other)
equals
in class org.jamesframework.core.problems.Solution
other
- object to compare for equalitytrue
if the given object is an equal permutation solutionpublic int hashCode()
equals(Object)
.hashCode
in class org.jamesframework.core.problems.Solution
Copyright © 2015. All rights reserved.