spepping 2004/09/05 12:16:40 Added: src/java/org/apache/fop/layoutmgr KnuthBox.java KnuthElement.java KnuthGlue.java KnuthPenalty.java KnuthPossPosIter.java Log: These new classes are part of the implementation of the new line breaking algorithm, patch 29124, submitted by Luca Furini. Revision Changes Path 1.1 xml-fop/src/java/org/apache/fop/layoutmgr/KnuthBox.java Index: KnuthBox.java =================================================================== package org.apache.fop.layoutmgr; public class KnuthBox extends KnuthElement { private int lead; private int total; private int middle; public KnuthBox(int w, int l, int t, int m, Position pos, boolean bAux) { super(KNUTH_BOX, w, pos, bAux); lead = l; total = t; middle = m; } public int getLead() { return lead; } public int getTotal() { return total; } public int getMiddle() { return middle; } } 1.1 xml-fop/src/java/org/apache/fop/layoutmgr/KnuthElement.java Index: KnuthElement.java =================================================================== package org.apache.fop.layoutmgr; public abstract class KnuthElement { public static final int KNUTH_BOX = 0; public static final int KNUTH_GLUE = 1; public static final int KNUTH_PENALTY = 2; public static final int INFINITE = 1000; private int type; private int width; private Position position; private boolean bIsAuxiliary; protected KnuthElement(int t, int w, Position pos, boolean bAux) { type = t; width = w; position = pos; bIsAuxiliary = bAux; } public boolean isBox() { return (type == KNUTH_BOX); } public boolean isGlue() { return (type == KNUTH_GLUE); } public boolean isPenalty() { return (type == KNUTH_PENALTY); } public boolean isAuxiliary() { return bIsAuxiliary; } public int getW() { return width; } public Position getPosition() { return position; } public void setPosition(Position pos) { position = pos; } public LayoutManager getLayoutManager() { if (position != null) { return position.getLM(); } else { return null; } } } 1.1 xml-fop/src/java/org/apache/fop/layoutmgr/KnuthGlue.java Index: KnuthGlue.java =================================================================== package org.apache.fop.layoutmgr; public class KnuthGlue extends KnuthElement { private int stretchability; private int shrinkability; public KnuthGlue(int w, int y, int z, Position pos, boolean bAux) { super(KNUTH_GLUE, w, pos, bAux); stretchability = y; shrinkability = z; } public int getY() { return stretchability; } public int getZ() { return shrinkability; } } 1.1 xml-fop/src/java/org/apache/fop/layoutmgr/KnuthPenalty.java Index: KnuthPenalty.java =================================================================== package org.apache.fop.layoutmgr; public class KnuthPenalty extends KnuthElement { private int penalty; private boolean bFlagged; public KnuthPenalty(int w, int p, boolean f, Position pos, boolean bAux) { super(KNUTH_PENALTY, w, pos, bAux); penalty = p; bFlagged = f; } public int getP() { return penalty; } public boolean isFlagged() { return bFlagged; } } 1.1 xml-fop/src/java/org/apache/fop/layoutmgr/KnuthPossPosIter.java Index: KnuthPossPosIter.java =================================================================== package org.apache.fop.layoutmgr; import java.util.List; public class KnuthPossPosIter extends PositionIterator { private int iterCount; /** * Main constructor * @param bpList List of break possibilities * @param startPos starting position * @param endPos ending position */ public KnuthPossPosIter(List bpList, int startPos, int endPos) { super(bpList.listIterator(startPos)); iterCount = endPos - startPos; } // Check position < endPos /** * @see org.apache.fop.layoutmgr.PositionIterator#checkNext() */ protected boolean checkNext() { if (iterCount > 0) { return super.checkNext(); } else { endIter(); return false; } } /** * @see java.util.Iterator#next() */ public Object next() { --iterCount; return super.next(); } public KnuthElement getKE() { return (KnuthElement) peekNext(); } protected LayoutManager getLM(Object nextObj) { return ((KnuthElement) nextObj).getLayoutManager(); } protected Position getPos(Object nextObj) { return ((KnuthElement) nextObj).getPosition(); } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]