public final class Penalty extends Object
Integer, but giving Integer.MAX_VALUE a special meaning: it means infinite
penalty, i.e. a candidate with this penalty will be excluded from any choice.| Modifier and Type | Field | Description |
|---|---|---|
static Penalty |
INFINITE_PENALTY |
|
static Penalty |
ZERO_PENALTY |
| Modifier and Type | Method | Description |
|---|---|---|
Penalty |
add(int value) |
Adds a penalty to this one and returns the combined penalty.
|
Penalty |
add(Penalty value) |
Adds a penalty to this one and returns the combined penalty.
|
int |
getValue() |
Returns the penalty value.
|
boolean |
isInfinitePenalty() |
Indicates whether this is an infinite penalty, meaning that a solution with this penalty
is effectively ineligible.
|
static Penalty |
toPenalty(int value) |
Turns a penalty value into a penaly object.
|
String |
toString() |
|
static int |
truncate(long penalty) |
Truncates the long penalty value to an integer without sign side-effects.
|
public static final Penalty ZERO_PENALTY
public static final Penalty INFINITE_PENALTY
public static Penalty toPenalty(int value)
value - the penalty valuepublic Penalty add(Penalty value)
value - the penalty value to addpublic Penalty add(int value)
value - the penalty value to addpublic int getValue()
public boolean isInfinitePenalty()
public static int truncate(long penalty)
penalty - the penalty value as a longCopyright © 2018 Apache Software Foundation. All rights reserved.