|
fop 1.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.fop.layoutmgr.ListElement
org.apache.fop.layoutmgr.KnuthElement
org.apache.fop.layoutmgr.KnuthPenalty
public class KnuthPenalty
An instance of this class represents information about a feasible breaking point; it does not represent any piece of content. A KnuthPenalty is a feasible breaking point unless its value is infinity; a KnuthPenalty whose value is -infinity represents a forced break. A KnuthPenalty is suppressed, and its width is ignored, if it is not a chosen breaking point; for example, a KnuthPenalty representing a hyphenation point has a width (the "-" width), which must be ignored if that point is not chosen as a breaking point. Besides the inherited methods and attributes, this class has two more attributes and the methods used to get them: the penalty value, which is a kind of "aesthetic cost" (the higher the value, the more unsightly the breaking point), and a boolean that marks KnuthPenalties which should not be chosen as breaking points for consecutive lines.
Field Summary | |
---|---|
static int |
FLAGGED_PENALTY
Used for flagged penalties. |
Fields inherited from class org.apache.fop.layoutmgr.KnuthElement |
---|
INFINITE |
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
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 . |
Methods inherited from class org.apache.fop.layoutmgr.KnuthElement |
---|
getShrink, getStretch, getWidth, isAuxiliary, isUnresolvedElement |
Methods inherited from class org.apache.fop.layoutmgr.ListElement |
---|
getLayoutManager, getPosition, isBox, isGlue, setPosition |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int FLAGGED_PENALTY
Constructor Detail |
---|
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?Method Detail |
---|
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 value
String
public boolean isPenalty()
isPenalty
in class ListElement
public int getPenalty()
getPenalty
in class KnuthElement
public void setPenalty(int penalty)
penalty
- the new penalty valuepublic boolean isPenaltyFlagged()
public boolean isForcedBreak()
isForcedBreak
in class ListElement
public int getBreakClass()
public java.lang.String toString()
toString
in class java.lang.Object
|
fop 1.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |