choco.kernel.common.util.comparator
Class AbstractSortingPermutation
java.lang.Object
choco.kernel.common.util.comparator.AbstractSortingPermutation
- All Implemented Interfaces:
- IPermutation, Comparator<Integer>
- Direct Known Subclasses:
- ConstantPermutation, IntPermutation
public abstract class AbstractSortingPermutation
- extends Object
- implements IPermutation, Comparator<Integer>
IDENTITY
public static final IPermutation IDENTITY
identity
protected boolean identity
orderingPermutation
protected final Integer[] orderingPermutation
reversePermutation
protected final Integer[] reversePermutation
AbstractSortingPermutation
public AbstractSortingPermutation(int size)
sort
public final void sort(boolean reverse)
applyPermutation
public final <T> void applyPermutation(T[] source,
T[] dest)
- Description copied from interface:
IPermutation
- apply the permutation on the source array
- Specified by:
applyPermutation
in interface IPermutation
- Parameters:
source
- the array to be permuteddest
- the permuted array
applyPermutation
public <T> void applyPermutation(List<T> source,
T[] dest)
- Specified by:
applyPermutation
in interface IPermutation
applyPermutation
public int[] applyPermutation(int[] source)
- Description copied from interface:
IPermutation
- apply the permutation to the integer array
- Specified by:
applyPermutation
in interface IPermutation
- Returns:
- the permuted array
getOriginalIndex
public final int getOriginalIndex(int idx)
- return the original index of the idx-th element of the permuted array
- Specified by:
getOriginalIndex
in interface IPermutation
- Parameters:
idx
- the permutation index
- Returns:
- the index in the original order
getPermutationIndex
public final int getPermutationIndex(int idx)
- return the index in the permutation of the idx-th element
- Specified by:
getPermutationIndex
in interface IPermutation
- Parameters:
idx
- the index in the original order
- Returns:
- the index in the permutation
isIdentity
public final boolean isIdentity()
- Specified by:
isIdentity
in interface IPermutation
toString
public String toString()
- Overrides:
toString
in class Object
Copyright © 2012. All Rights Reserved.