|
xmlgraphics-commons 1.4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.xmlgraphics.image.loader.util.Penalty
public class Penalty
Immutable class representing a penalty value. It's valid value range is that of an
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.
Field Summary | |
---|---|
static Penalty |
INFINITE_PENALTY
|
static Penalty |
ZERO_PENALTY
|
Method Summary | |
---|---|
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. |
java.lang.String |
toString()
|
static int |
truncate(long penalty)
Truncates the long penalty value to an integer without sign side-effects. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Penalty ZERO_PENALTY
public static final Penalty INFINITE_PENALTY
Method Detail |
---|
public static Penalty toPenalty(int value)
value
- the penalty value
public Penalty add(Penalty value)
value
- the penalty value to add
public Penalty add(int value)
value
- the penalty value to add
public int getValue()
public boolean isInfinitePenalty()
public java.lang.String toString()
toString
in class java.lang.Object
public static int truncate(long penalty)
penalty
- the penalty value as a long
|
xmlgraphics-commons 1.4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |