Interface Score<Score_ extends Score<Score_>>
- Type Parameters:
Score_- the actual score type to allow addition, subtraction and other arithmetic
- All Superinterfaces:
Comparable<Score_>,Serializable
- All Known Subinterfaces:
IBendableScore<Score_>
- All Known Implementing Classes:
AbstractBendableScore,AbstractScore,BendableBigDecimalScore,BendableLongScore,BendableScore,HardMediumSoftBigDecimalScore,HardMediumSoftLongScore,HardMediumSoftScore,HardSoftBigDecimalScore,HardSoftLongScore,HardSoftScore,SimpleBigDecimalScore,SimpleLongScore,SimpleScore
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionabs()Returns a Score whose value is the absolute value of the score, i.e.Returns a Score whose value is (this + addend).divide(double divisor) Returns a Score whose value is (this / divisor).default intDeprecated, for removal: This API element is subject to removal in a future version.No point in using this method anymore.default intDeprecated, for removal: This API element is subject to removal in a future version.No point in using this method anymore.booleanAPlanningSolutionis feasible if it has no broken hard constraints.default booleanDeprecated, for removal: This API element is subject to removal in a future version.No point in using this method anymore.default booleanisZero()multiply(double multiplicand) Returns a Score whose value is (this * multiplicand).default Score_negate()Returns a Score whose value is (- this).power(double exponent) Returns a Score whose value is (this ^ exponent).Returns a Score whose value is (this - subtrahend).default double[]As defined bytoLevelNumbers(), only returns double[] instead of Number[].Number[]Returns an array of numbers representing the Score.LikeObject.toString(), but trims score levels which have a zero weight.default Score_withInitScore(int newInitScore) Deprecated, for removal: This API element is subject to removal in a future version.No point in using this method anymore.zero()Returns a Score, all levels of which are zero.Methods inherited from interface java.lang.Comparable
compareTo
-
Method Details
-
initScore
Deprecated, for removal: This API element is subject to removal in a future version.No point in using this method anymore.- Returns:
- Always zero.
-
getInitScore
Deprecated, for removal: This API element is subject to removal in a future version.No point in using this method anymore.- Returns:
- Always zero.
-
withInitScore
Deprecated, for removal: This API element is subject to removal in a future version.No point in using this method anymore.- Returns:
- this, init score always zero.
-
add
Returns a Score whose value is (this + addend).- Parameters:
addend- value to be added to this Score- Returns:
- this + addend
-
subtract
Returns a Score whose value is (this - subtrahend).- Parameters:
subtrahend- value to be subtracted from this Score- Returns:
- this - subtrahend, rounded as necessary
-
multiply
Returns a Score whose value is (this * multiplicand). When rounding is needed, it should be floored (as defined byMath.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.
- Parameters:
multiplicand- value to be multiplied by this Score.- Returns:
- this * multiplicand
-
divide
Returns a Score whose value is (this / divisor). When rounding is needed, it should be floored (as defined byMath.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.
- Parameters:
divisor- value by which this Score is to be divided- Returns:
- this / divisor
-
power
Returns a Score whose value is (this ^ exponent). When rounding is needed, it should be floored (as defined byMath.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.
- Parameters:
exponent- value by which this Score is to be powered- Returns:
- this ^ exponent
-
negate
Returns a Score whose value is (- this).- Returns:
- - this
-
abs
Score_ abs()Returns a Score whose value is the absolute value of the score, i.e. |this|. -
zero
Score_ zero()Returns a Score, all levels of which are zero. -
isZero
default boolean isZero()- Returns:
- true when this
is equal tozero().
-
toLevelNumbers
Number[] toLevelNumbers()Returns an array of numbers representing the Score. Each number represents 1 score level. A greater score level uses a lower array index than a lesser score level.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 specificScoreimplementation.For example:
-0hard/-7softreturnsnew int{-0, -7} -
toLevelDoubles
default double[] toLevelDoubles()As defined bytoLevelNumbers(), only returns double[] instead of Number[]. -
isSolutionInitialized
Deprecated, for removal: This API element is subject to removal in a future version.No point in using this method anymore.- Returns:
- always true
-
isFeasible
boolean isFeasible()APlanningSolutionis feasible if it has no broken hard constraints. Simple scores (SimpleScore,SimpleLongScore,SimpleBigDecimalScore) are always feasible.- Returns:
- true if the hard score is 0 or higher.
-
toShortString
String toShortString()LikeObject.toString(), but trims score levels which have a zero weight. For example 0hard/-258soft returns -258soft.Do not use this format to persist information as text, use
Object.toString()instead, so it can be parsed reliably.
-