public final class BendableBigDecimalScore extends AbstractBendableScore<BendableBigDecimalScore> implements FeasibilityScore<BendableBigDecimalScore>
Score is based on n levels of BigDecimal 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
BendableScoreDefinition used.
Score,
Serialized FormHARD_LABEL, LEVEL_SUFFIXES, SOFT_LABELINIT_LABEL, initScore| Modifier | Constructor and Description |
|---|---|
protected |
BendableBigDecimalScore(int initScore,
BigDecimal[] hardScores,
BigDecimal[] softScores) |
| Modifier and Type | Method and Description |
|---|---|
BendableBigDecimalScore |
add(BendableBigDecimalScore augment)
Returns a Score whose value is (this + augment).
|
int |
compareTo(BendableBigDecimalScore other) |
BendableBigDecimalScore |
divide(double divisor)
Returns a Score whose value is (this / divisor).
|
boolean |
equals(Object o) |
int |
getHardLevelsSize() |
BigDecimal |
getHardOrSoftScore(int index) |
BigDecimal |
getHardScore(int index) |
int |
getLevelsSize() |
int |
getSoftLevelsSize() |
BigDecimal |
getSoftScore(int index) |
int |
hashCode() |
boolean |
isCompatibleArithmeticArgument(Score otherScore) |
boolean |
isFeasible()
A
PlanningSolution is feasible if it has no broken hard constraints
and Score.isSolutionInitialized() is true. |
BendableBigDecimalScore |
multiply(double multiplicand)
Returns a Score whose value is (this * multiplicand).
|
BendableBigDecimalScore |
negate()
Returns a Score whose value is (- this).
|
static BendableBigDecimalScore |
parseScore(String scoreString) |
BendableBigDecimalScore |
power(double exponent)
Returns a Score whose value is (this ^ exponent).
|
BendableBigDecimalScore |
subtract(BendableBigDecimalScore subtrahend)
Returns a Score whose value is (this - subtrahend).
|
BendableBigDecimalScore |
toInitializedScore()
For example
-7init/0hard/-8soft returns 0hard/-8soft. |
Number[] |
toLevelNumbers()
Returns an array of numbers representing the Score.
|
String |
toString() |
void |
validateCompatible(BendableBigDecimalScore other) |
static BendableBigDecimalScore |
valueOf(int initScore,
BigDecimal[] hardScores,
BigDecimal[] softScores)
Creates a new
BendableBigDecimalScore. |
static BendableBigDecimalScore |
valueOfInitialized(BigDecimal[] hardScores,
BigDecimal[] softScores)
Creates a new
BendableBigDecimalScore. |
parseBendableScoreTokensbuildScorePattern, getInitPrefix, getInitScore, isSolutionInitialized, parseInitScore, parseLevelAsBigDecimal, parseLevelAsDouble, parseLevelAsInt, parseLevelAsLong, parseScoreTokensclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetInitScore, isSolutionInitializedprotected BendableBigDecimalScore(int initScore,
BigDecimal[] hardScores,
BigDecimal[] softScores)
initScore - see Score.getInitScore()hardScores - never nullsoftScores - never nullpublic static BendableBigDecimalScore parseScore(String scoreString)
scoreString - never nullpublic static BendableBigDecimalScore valueOf(int initScore, BigDecimal[] hardScores, BigDecimal[] softScores)
BendableBigDecimalScore.initScore - see Score.getInitScore()hardScores - never null, never change that array afterwards: it must be immutablesoftScores - never null, never change that array afterwards: it must be immutablepublic static BendableBigDecimalScore valueOfInitialized(BigDecimal[] hardScores, BigDecimal[] softScores)
BendableBigDecimalScore.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()
getHardLevelsSize in class AbstractBendableScore<BendableBigDecimalScore>>= 0public BigDecimal getHardScore(int index)
index - 0 <= index < getHardLevelsSize()public int getSoftLevelsSize()
getSoftLevelsSize in class AbstractBendableScore<BendableBigDecimalScore>>= 0public BigDecimal getSoftScore(int index)
index - 0 <= index < getSoftLevelsSize()public BendableBigDecimalScore toInitializedScore()
Score-7init/0hard/-8soft returns 0hard/-8soft.toInitializedScore in interface Score<BendableBigDecimalScore>Score.getInitScore() is 0.public int getLevelsSize()
getLevelsSize in class AbstractBendableScore<BendableBigDecimalScore>AbstractBendableScore.getHardLevelsSize() + AbstractBendableScore.getSoftLevelsSize()public BigDecimal getHardOrSoftScore(int index)
index - 0 <= index < getLevelsSize()public boolean isFeasible()
FeasibilityScorePlanningSolution is feasible if it has no broken hard constraints
and Score.isSolutionInitialized() is true.isFeasible in interface FeasibilityScore<BendableBigDecimalScore>Score.getInitScore() is 0.public BendableBigDecimalScore add(BendableBigDecimalScore augment)
Scoreadd in interface Score<BendableBigDecimalScore>augment - value to be added to this Scorepublic BendableBigDecimalScore subtract(BendableBigDecimalScore subtrahend)
Scoresubtract in interface Score<BendableBigDecimalScore>subtrahend - value to be subtracted from this Scorepublic BendableBigDecimalScore 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<BendableBigDecimalScore>multiplicand - value to be multiplied by this Score.public BendableBigDecimalScore 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<BendableBigDecimalScore>divisor - value by which this Score is to be dividedpublic BendableBigDecimalScore 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<BendableBigDecimalScore>exponent - value by which this Score is to be poweredpublic BendableBigDecimalScore negate()
Scorenegate in interface Score<BendableBigDecimalScore>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}
The level numbers do not contain the Score.getInitScore().
For example: -3init/-0hard/-7soft also returns new int{-0, -7}
toLevelNumbers in interface Score<BendableBigDecimalScore>ScoreDefinition.fromLevelNumbers(int, Number[])public int compareTo(BendableBigDecimalScore other)
compareTo in interface Comparable<BendableBigDecimalScore>public void validateCompatible(BendableBigDecimalScore other)
public boolean isCompatibleArithmeticArgument(Score otherScore)
isCompatibleArithmeticArgument in interface Score<BendableBigDecimalScore>isCompatibleArithmeticArgument in class AbstractScore<BendableBigDecimalScore>otherScore - never nullScore.add(Score), Score.subtract(Score)
and Comparable.compareTo(Object).Copyright © 2006–2016 JBoss by Red Hat. All rights reserved.