public final class CombinationUtil extends Object
NO_VALUE.| Modifier and Type | Field and Description |
|---|---|
static int |
NO_VALUE
The value used to indicate that a parameter has not been assigned a value in a combination.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
add(int[] combination,
int[] toBeAdded)
Adds the combination to be added to the first one.
|
static boolean |
canBeAdded(int[] combination,
int[] toBeAdded,
ConstraintChecker constraintChecker)
Checks whether the combinations to be added can be added to the given combinations.
|
static boolean |
contains(int[] firstCombination,
int[] secondCombination)
Checks whether the first combinations contains the second one.
|
static boolean |
containsAllParameters(int[] combination,
int untilParameter)
Checks whether all the combination contains all parameters until the given index, that is whether all fields
in the combination array until the index are not set to
NO_VALUE. |
static boolean |
containsAllParameters(int[] combination,
it.unimi.dsi.fastutil.ints.IntSet parameterIndices)
Checks whether a combinations contains all parameter, that is whether the field for all given parameters is
not set to
NO_VALUE. |
static int[] |
emptyCombination(int size)
Creates a new combinations which is empty.
|
static int |
numberOfSetParameters(int[] combination)
Calculates the number of parameters in the combinations not set to
NO_VALUE. |
static boolean |
sameForAllGivenParameters(int[] first,
int[] second,
it.unimi.dsi.fastutil.ints.IntSet parameters)
Checks whether the two combinations have exactly the same value for each of the given parameters.
|
public static final int NO_VALUE
public static int[] emptyCombination(int size)
NO_VALUE.
For example, for the size 5, [-1, -1, -1, -1, -1] is returned.size - the number of parameters for the combinations. Must be greater that or equal to zeroNO_VALUEpublic static boolean contains(int[] firstCombination,
int[] secondCombination)
firstCombination - a combination. Must not be nullsecondCombination - a combination for which it is checked whether it is contained in the first one. Must not
be null and must be of the same size as the first combinationpublic static boolean canBeAdded(int[] combination,
int[] toBeAdded,
ConstraintChecker constraintChecker)
combination - a combination. Must not be nulltoBeAdded - another combination which should be added to the first one. Must not be null and must be
of the same size as the first combinationconstraintChecker - checks whether the result combination would be valid. Must not be null. If this
is not important, give a
NoConstraintCheckerpublic static void add(int[] combination,
int[] toBeAdded)
NO_VALUE.
canBeAdded(int[], int[], ConstraintChecker) would return true for both combinations if the
result combinations only differs form the first given combinations in places where it was
NO_VALUE. Examples:
[0] [-1] becomes [0]
[-1] [0] becomes [0]
[0, -1, 2, -1] [-1, 2, 2, -1] becomes [0, 2, 2, -1]combination - a combination. Must not be nulltoBeAdded - another combination which is added to the first one using the rules explained above. Must not
be null and must be the same length as the first combinationpublic static boolean containsAllParameters(int[] combination,
it.unimi.dsi.fastutil.ints.IntSet parameterIndices)
NO_VALUE.combination - the combination. Must not be nullparameterIndices - the parameter to check. Must not be null but can be emptypublic static boolean containsAllParameters(int[] combination,
int untilParameter)
NO_VALUE.combination - a combinationuntilParameter - the parameter index until which to check (inclusivelyNO_VALUE on any given parameter indexpublic static boolean sameForAllGivenParameters(int[] first,
int[] second,
it.unimi.dsi.fastutil.ints.IntSet parameters)
first - a combination. Must not be nullsecond - another combination. Must not be null and must be the same length as the first combinationparameters - the parameters to check (indices)public static int numberOfSetParameters(int[] combination)
NO_VALUE.combination - a combination. Most not be nullCopyright © 2019. All rights reserved.