public interface ScoreDefinition<S extends Score<S>>
AbstractScoreDefinition
,
HardSoftScoreDefinition
Modifier and Type | Method and Description |
---|---|
S |
buildOptimisticBound(InitializingScoreTrend initializingScoreTrend,
S score)
|
S |
buildPessimisticBound(InitializingScoreTrend initializingScoreTrend,
S score)
|
ScoreHolder<S> |
buildScoreHolder(boolean constraintMatchEnabled)
Used by
DroolsScoreDirector . |
ScoreInliner<S> |
buildScoreInliner(boolean constraintMatchEnabled)
Used by
BavetConstraintFactory |
S |
divideBySanitizedDivisor(S dividend,
S divisor)
Return
Score whose every level is the result of dividing the matching levels in this and the divisor. |
String |
formatScore(S score)
|
S |
fromLevelNumbers(int initScore,
Number[] levelNumbers)
The opposite of
Score.toLevelNumbers() . |
int |
getFeasibleLevelsSize()
Returns the number of levels of
Score.toLevelNumbers() . |
String |
getInitLabel()
Returns the label for
Score.getInitScore() . |
String[] |
getLevelLabels()
Returns a label for each score level.
|
int |
getLevelsSize()
Returns the length of
Score.toLevelNumbers() for every Score of this definition. |
S |
getOneSoftestScore()
The score that represents the softest possible one.
|
Class<S> |
getScoreClass()
|
S |
getZeroScore()
The score that represents zero.
|
boolean |
isCompatibleArithmeticArgument(Score score) |
default boolean |
isNegativeOrZero(S score) |
default boolean |
isPositiveOrZero(S score) |
S |
parseScore(String scoreString)
|
String getInitLabel()
Score.getInitScore()
.getLevelLabels()
int getLevelsSize()
Score.toLevelNumbers()
for every Score
of this definition.
For example: returns 2 on HardSoftScoreDefinition
.int getFeasibleLevelsSize()
Score.toLevelNumbers()
.
that are used to determine Score.isFeasible()
.getLevelsSize()
String[] getLevelLabels()
{"hard score", "soft score "}
on HardSoftScoreDefinition
.
It does not include the getInitLabel()
.
getLevelsSize()
, each element is never nullClass<S> getScoreClass()
Class
of the actual Score
implementation.
For example: returns HardSoftScore.class
on HardSoftScoreDefinition
.S getZeroScore()
S getOneSoftestScore()
default boolean isPositiveOrZero(S score)
score
- never nullgetZeroScore()
default boolean isNegativeOrZero(S score)
score
- never nullgetZeroScore()
String formatScore(S score)
score
- never nullparseScore(String)
S parseScore(String scoreString)
scoreString
- never nullformatScore(Score)
,
ScoreUtils.parseScore(Class, String)
S fromLevelNumbers(int initScore, Number[] levelNumbers)
Score.toLevelNumbers()
.initScore
- <= 0
, managed by OptaPlanner, needed as a parameter in the Score
's creation
method, see Score.getInitScore()
levelNumbers
- never nullScoreInliner<S> buildScoreInliner(boolean constraintMatchEnabled)
BavetConstraintFactory
constraintMatchEnabled
- true if ScoreDirector.isConstraintMatchEnabled()
should be trueScoreHolder<S> buildScoreHolder(boolean constraintMatchEnabled)
DroolsScoreDirector
.constraintMatchEnabled
- true if ScoreDirector.isConstraintMatchEnabled()
should be trueS buildOptimisticBound(InitializingScoreTrend initializingScoreTrend, S score)
Score
which is equal or better than any other Score
with more variables initialized
(while the already variables don't change).initializingScoreTrend
- never null, with InitializingScoreTrend.getLevelsSize()
equal to getLevelsSize()
.score
- never null, with Score.getInitScore()
0
.S buildPessimisticBound(InitializingScoreTrend initializingScoreTrend, S score)
Score
which is equal or worse than any other Score
with more variables initialized
(while the already variables don't change).initializingScoreTrend
- never null, with InitializingScoreTrend.getLevelsSize()
equal to getLevelsSize()
.score
- never null, with Score.getInitScore()
0
S divideBySanitizedDivisor(S dividend, S divisor)
Score
whose every level is the result of dividing the matching levels in this and the divisor.
When rounding is needed, it is floored (as defined by Math.floor(double)
).
If any of the levels in the divisor are equal to zero, the method behaves as if they were equal to one instead.
divisor
- value by which this Score is to be dividedboolean isCompatibleArithmeticArgument(Score score)
score
- never nullScore.add(Score)
,
Score.subtract(Score)
and Comparable.compareTo(Object)
for scores of this score definition.Copyright © 2006–2021 JBoss by Red Hat. All rights reserved.