public interface Score<S extends Score> extends Comparable<S>
Implementations must be immutable.
Implementations are allowed to optionally implement Pareto comparison
and therefore slightly violate the transitive requirement of Comparable.compareTo(Object).
An implementation must extend AbstractScore to ensure backwards compatibility in future versions.
AbstractScore,
HardSoftScore| Modifier and Type | Method and Description |
|---|---|
S |
add(S augment)
Returns a Score whose value is (this + augment).
|
S |
divide(double divisor)
Returns a Score whose value is (this / divisor).
|
boolean |
isCompatibleArithmeticArgument(Score otherScore) |
S |
multiply(double multiplicand)
Returns a Score whose value is (this * multiplicand).
|
S |
negate()
Returns a Score whose value is (- this).
|
S |
power(double exponent)
Returns a Score whose value is (this ^ exponent).
|
S |
subtract(S subtrahend)
Returns a Score whose value is (this - subtrahend).
|
Number[] |
toLevelNumbers()
Returns an array of numbers representing the Score.
|
compareToS add(S augment)
augment - value to be added to this ScoreS subtract(S subtrahend)
subtrahend - value to be subtracted from this ScoreS multiply(double multiplicand)
Math.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.
multiplicand - value to be multiplied by this Score.S divide(double divisor)
Math.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.
divisor - value by which this Score is to be dividedS power(double exponent)
Math.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.
exponent - value by which this Score is to be poweredS negate()
Number[] toLevelNumbers()
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}
boolean isCompatibleArithmeticArgument(Score otherScore)
otherScore - never nulladd(Score), subtract(Score)
and Comparable.compareTo(Object).Copyright © 2006–2015 JBoss by Red Hat. All rights reserved.