public class KnuthPenalty extends KnuthElement
| Modifier and Type | Field and Description |
|---|---|
static KnuthPenalty |
DUMMY_ZERO_PENALTY
Dummy, zero-width penalty
|
static int |
FLAGGED_PENALTY
Used for flagged penalties.
|
INFINITE| Constructor and Description |
|---|
KnuthPenalty(int width,
int penalty,
boolean penaltyFlagged,
int breakClass,
Position pos,
boolean isAuxiliary)
Create a new KnuthPenalty.
|
KnuthPenalty(int width,
int penalty,
boolean penaltyFlagged,
Position pos,
boolean auxiliary)
Create a new KnuthPenalty.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getBreakClass() |
int |
getPenalty() |
boolean |
isForcedBreak() |
boolean |
isPenalty() |
boolean |
isPenaltyFlagged() |
void |
setPenalty(int penalty)
Sets a new penalty value.
|
java.lang.String |
toString() |
protected static java.lang.String |
valueOf(int penaltyValue)
Get the penalty's value as a
String. |
getShrink, getStretch, getWidth, isAuxiliary, isUnresolvedElementgetLayoutManager, getPosition, isBox, isGlue, setPositionpublic static final int FLAGGED_PENALTY
public static final KnuthPenalty DUMMY_ZERO_PENALTY
public KnuthPenalty(int width,
int penalty,
boolean penaltyFlagged,
Position pos,
boolean auxiliary)
width - the width of this penaltypenalty - the penalty value of this penaltypenaltyFlagged - is this penalty flagged?pos - the Position stored in this penaltyauxiliary - is this penalty auxiliary?public KnuthPenalty(int width,
int penalty,
boolean penaltyFlagged,
int breakClass,
Position pos,
boolean isAuxiliary)
width - the width of this penaltypenalty - the penalty value of this penaltypenaltyFlagged - is this penalty flagged?breakClass - the break class of this penalty (one of
Constants.EN_AUTO,
Constants.EN_COLUMN,
Constants.EN_PAGE,
Constants.EN_EVEN_PAGE,
Constants.EN_ODD_PAGE).pos - the Position stored in this penaltyisAuxiliary - is this penalty auxiliary?protected static java.lang.String valueOf(int penaltyValue)
String.
(Mainly used in toString() methods, to improve readability
of the trace logs.)
TODO: shouldn't be penalty a class of its own?penaltyValue - the penalty valueStringpublic boolean isPenalty()
isPenalty in class ListElementpublic int getPenalty()
getPenalty in class KnuthElementpublic void setPenalty(int penalty)
penalty - the new penalty valuepublic boolean isPenaltyFlagged()
public boolean isForcedBreak()
isForcedBreak in class ListElementpublic int getBreakClass()
public java.lang.String toString()
toString in class java.lang.ObjectCopyright 1999-2022 The Apache Software Foundation. All Rights Reserved.