public final class BendableLongScore extends AbstractScore<BendableLongScore> implements FeasibilityScore<BendableLongScore>
Score is based on n levels of long constraints.
The number of levels is bendable at configuration time.
This class is immutable.
The getHardLevelsSize() and getSoftLevelsSize() must be the same as in the
BendableLongScoreDefinition used.
Score,
Serialized Form| Modifier | Constructor and Description |
|---|---|
protected |
BendableLongScore(long[] hardScores,
long[] softScores) |
| Modifier and Type | Method and Description |
|---|---|
BendableLongScore |
add(BendableLongScore augment)
Returns a Score whose value is (this + augment).
|
int |
compareTo(BendableLongScore other) |
BendableLongScore |
divide(double divisor)
Returns a Score whose value is (this / divisor).
|
boolean |
equals(Object o) |
int |
getHardLevelsSize() |
long |
getHardOrSoftScore(int index) |
long |
getHardScore(int index) |
int |
getLevelsSize() |
int |
getSoftLevelsSize() |
long |
getSoftScore(int index) |
int |
hashCode() |
boolean |
isCompatibleArithmeticArgument(Score otherScore) |
boolean |
isFeasible()
A
Solution is feasible if it has no broken hard constraints. |
BendableLongScore |
multiply(double multiplicand)
Returns a Score whose value is (this * multiplicand).
|
BendableLongScore |
negate()
Returns a Score whose value is (- this).
|
static BendableLongScore |
parseScore(int hardLevelsSize,
int softLevelsSize,
String scoreString) |
BendableLongScore |
power(double exponent)
Returns a Score whose value is (this ^ exponent).
|
BendableLongScore |
subtract(BendableLongScore subtrahend)
Returns a Score whose value is (this - subtrahend).
|
Number[] |
toLevelNumbers()
Returns an array of numbers representing the Score.
|
String |
toString() |
void |
validateCompatible(BendableLongScore other) |
static BendableLongScore |
valueOf(long[] hardScores,
long[] softScores)
Creates a new
BendableLongScore. |
buildScorePattern, buildScorePattern, parseLevelAsBigDecimal, parseLevelAsDouble, parseLevelAsInt, parseLevelAsLong, parseLevelStrings, parseLevelStringsprotected BendableLongScore(long[] hardScores,
long[] softScores)
public static BendableLongScore parseScore(int hardLevelsSize, int softLevelsSize, String scoreString)
public static BendableLongScore valueOf(long[] hardScores, long[] softScores)
BendableLongScore.hardScores - never null, never change that array afterwards: it must be immutablesoftScores - never null, never change that array afterwards: it must be immutablepublic int getHardLevelsSize()
public long getHardScore(int index)
index - 0 <= index < getHardLevelsSize()public int getSoftLevelsSize()
public long getSoftScore(int index)
index - 0 <= index < getSoftLevelsSize()public int getLevelsSize()
getHardLevelsSize() + getSoftLevelsSize()public long getHardOrSoftScore(int index)
index - 0 <= index < getLevelsSize()public boolean isFeasible()
FeasibilityScoreSolution is feasible if it has no broken hard constraints.isFeasible in interface FeasibilityScore<BendableLongScore>public BendableLongScore add(BendableLongScore augment)
Scoreadd in interface Score<BendableLongScore>augment - value to be added to this Scorepublic BendableLongScore subtract(BendableLongScore subtrahend)
Scoresubtract in interface Score<BendableLongScore>subtrahend - value to be subtracted from this Scorepublic BendableLongScore multiply(double multiplicand)
ScoreMath.floor(double).
If the implementation has a scale/precision, then the unspecified scale/precision of the double multiplicand should have no impact on the returned scale/precision.
multiply in interface Score<BendableLongScore>multiplicand - value to be multiplied by this Score.public BendableLongScore divide(double divisor)
ScoreMath.floor(double).
If the implementation has a scale/precision, then the unspecified scale/precision of the double divisor should have no impact on the returned scale/precision.
divide in interface Score<BendableLongScore>divisor - value by which this Score is to be dividedpublic BendableLongScore power(double exponent)
ScoreMath.floor(double).
If the implementation has a scale/precision, then the unspecified scale/precision of the double exponent should have no impact on the returned scale/precision.
power in interface Score<BendableLongScore>exponent - value by which this Score is to be poweredpublic BendableLongScore negate()
Scorenegate in interface Score<BendableLongScore>public Number[] toLevelNumbers()
Score
When rounding is needed, each rounding should be floored (as defined by Math.floor(double).
The length of the returned array must be stable for a specific Score implementation.
For example: -0hard/-7soft returns new int{-0, -7}
toLevelNumbers in interface Score<BendableLongScore>ScoreDefinition.fromLevelNumbers(Number[])public int compareTo(BendableLongScore other)
compareTo in interface Comparable<BendableLongScore>public void validateCompatible(BendableLongScore other)
public boolean isCompatibleArithmeticArgument(Score otherScore)
isCompatibleArithmeticArgument in interface Score<BendableLongScore>isCompatibleArithmeticArgument in class AbstractScore<BendableLongScore>otherScore - never nullScore.add(Score), Score.subtract(Score)
and Comparable.compareTo(Object).Copyright © 2006–2016 JBoss by Red Hat. All rights reserved.