aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/layoutmgr/KnuthPenalty.java
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2005-03-08 15:03:06 +0000
committerJeremias Maerki <jeremias@apache.org>2005-03-08 15:03:06 +0000
commita392d777f6ab4c12ce5b6caaf179ad3f18032092 (patch)
treec93d01083f79134255896ee31542187786deb64b /src/java/org/apache/fop/layoutmgr/KnuthPenalty.java
parent3c010868dc685d17d958c71b7c116cef95769f81 (diff)
downloadxmlgraphics-fop-a392d777f6ab4c12ce5b6caaf179ad3f18032092.tar.gz
xmlgraphics-fop-a392d777f6ab4c12ce5b6caaf179ad3f18032092.zip
Refactoring of Knuth line breaking code (including some speed improvements)
Bugzilla: #32612 Submitted by: Finn Bock <bckfnn.at.worldonline.dk> git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198474 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/layoutmgr/KnuthPenalty.java')
-rw-r--r--src/java/org/apache/fop/layoutmgr/KnuthPenalty.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/KnuthPenalty.java b/src/java/org/apache/fop/layoutmgr/KnuthPenalty.java
index 0af1f3210..83b013132 100644
--- a/src/java/org/apache/fop/layoutmgr/KnuthPenalty.java
+++ b/src/java/org/apache/fop/layoutmgr/KnuthPenalty.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2004 The Apache Software Foundation.
+ * Copyright 2004-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -50,11 +50,15 @@ public class KnuthPenalty extends KnuthElement {
* @param bAux is this penalty auxiliary?
*/
public KnuthPenalty(int w, int p, boolean f, Position pos, boolean bAux) {
- super(KNUTH_PENALTY, w, pos, bAux);
+ super(w, pos, bAux);
penalty = p;
bFlagged = f;
}
+ public boolean isPenalty() {
+ return true;
+ }
+
/**
* Return the penalty value of this penalty.
*/
@@ -68,4 +72,8 @@ public class KnuthPenalty extends KnuthElement {
public boolean isFlagged() {
return bFlagged;
}
+
+ public boolean isForcedBreak() {
+ return penalty == -KnuthElement.INFINITE;
+ }
}