aboutsummaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
authorAdrian Cumiskey <acumiskey@apache.org>2008-06-09 14:33:04 +0000
committerAdrian Cumiskey <acumiskey@apache.org>2008-06-09 14:33:04 +0000
commit07ee324b35a7a7bf5d7cb8f704a0a2b62a89df5d (patch)
tree03ef74adc5a82a401e8247b3241b1dad2fb4219d /src/java
parent2ab4f01d9a5bf07e5f2b6ee4bb93dc107ef86eff (diff)
downloadxmlgraphics-fop-07ee324b35a7a7bf5d7cb8f704a0a2b62a89df5d.tar.gz
xmlgraphics-fop-07ee324b35a7a7bf5d7cb8f704a0a2b62a89df5d.zip
Merged revisions 665699 via svnmerge from
https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ........ r665699 | maxberger | 2008-06-09 15:15:38 +0100 (Mon, 09 Jun 2008) | 1 line Replaced LinkedList with generic List interface ........ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@665703 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
-rw-r--r--src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java6
-rw-r--r--src/java/org/apache/fop/layoutmgr/AbstractBreaker.java10
-rw-r--r--src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java6
-rw-r--r--src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java32
-rw-r--r--src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java2
-rw-r--r--src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java61
-rw-r--r--src/java/org/apache/fop/layoutmgr/ElementListUtils.java14
-rw-r--r--src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java17
-rw-r--r--src/java/org/apache/fop/layoutmgr/KnuthBlockBox.java17
-rw-r--r--src/java/org/apache/fop/layoutmgr/LayoutManager.java5
-rw-r--r--src/java/org/apache/fop/layoutmgr/PageBreaker.java6
-rw-r--r--src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java6
-rw-r--r--src/java/org/apache/fop/layoutmgr/SpaceResolver.java2
-rw-r--r--src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java28
-rw-r--r--src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java4
-rw-r--r--src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java4
-rw-r--r--src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java14
-rw-r--r--src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java12
-rwxr-xr-xsrc/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java15
-rw-r--r--src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java2
-rw-r--r--src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java8
-rw-r--r--src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java4
-rw-r--r--src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java24
-rw-r--r--src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java12
-rw-r--r--src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java6
-rw-r--r--src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java2
-rw-r--r--src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java23
-rw-r--r--src/java/org/apache/fop/layoutmgr/table/RowGroupLayoutManager.java6
-rw-r--r--src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java23
-rw-r--r--src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java8
30 files changed, 195 insertions, 184 deletions
diff --git a/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java b/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java
index 55bcfa44e..915208e2d 100644
--- a/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java
+++ b/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java
@@ -38,7 +38,7 @@ public class PrimaryGridUnit extends GridUnit {
/** Cell layout manager. */
private TableCellLayoutManager cellLM;
/** List of Knuth elements representing the contents of the cell. */
- private LinkedList elements;
+ private List elements;
/** Index of the row where this cell starts. */
private int rowIndex;
@@ -106,11 +106,11 @@ public class PrimaryGridUnit extends GridUnit {
*
* @param elements a list of ListElement (?)
*/
- public void setElements(LinkedList elements) {
+ public void setElements(List elements) {
this.elements = elements;
}
- public LinkedList getElements() {
+ public List getElements() {
return this.elements;
}
diff --git a/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java b/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
index 4ef0579f2..6f204383d 100644
--- a/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
+++ b/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
@@ -211,7 +211,7 @@ public abstract class AbstractBreaker {
* getNextKnuthElements() implementation(s) that are to be called.
* @return LinkedList of Knuth elements.
*/
- protected abstract LinkedList getNextKnuthElements(LayoutContext context, int alignment);
+ protected abstract List getNextKnuthElements(LayoutContext context, int alignment);
/** @return true if there's no content that could be handled. */
public boolean isEmpty() {
@@ -549,7 +549,7 @@ public abstract class AbstractBreaker {
childLC.signalSpanChange(Constants.NOT_SET);
BlockSequence blockList;
- LinkedList returnedList = getNextKnuthElements(childLC, alignment);
+ List returnedList = getNextKnuthElements(childLC, alignment);
if (returnedList != null) {
if (returnedList.size() == 0) {
nextSequenceStartsOn = handleSpanChange(childLC, nextSequenceStartsOn);
@@ -561,8 +561,10 @@ public abstract class AbstractBreaker {
nextSequenceStartsOn = handleSpanChange(childLC, nextSequenceStartsOn);
Position breakPosition = null;
- if (((KnuthElement) returnedList.getLast()).isForcedBreak()) {
- KnuthPenalty breakPenalty = (KnuthPenalty)returnedList.removeLast();
+ if (((KnuthElement) returnedList.get(returnedList.size() - 1))
+ .isForcedBreak()) {
+ KnuthPenalty breakPenalty = (KnuthPenalty) returnedList
+ .remove(returnedList.size() - 1);
breakPosition = breakPenalty.getPosition();
switch (breakPenalty.getBreakClass()) {
case Constants.EN_PAGE:
diff --git a/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java b/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
index 3f2143bae..13ea66d1f 100644
--- a/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
@@ -20,14 +20,12 @@
package org.apache.fop.layoutmgr;
import java.util.ArrayList;
-import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
import org.apache.fop.area.Area;
import org.apache.fop.area.PageViewport;
import org.apache.fop.fo.Constants;
@@ -152,7 +150,7 @@ public abstract class AbstractLayoutManager extends AbstractBaseLayoutManager
}
/** {@inheritDoc} */
- public LinkedList getNextKnuthElements(LayoutContext context,
+ public List getNextKnuthElements(LayoutContext context,
int alignment) {
log.warn("null implementation of getNextKnuthElements() called!");
setFinished(true);
@@ -160,7 +158,7 @@ public abstract class AbstractLayoutManager extends AbstractBaseLayoutManager
}
/** {@inheritDoc} */
- public LinkedList getChangedKnuthElements(List oldList,
+ public List getChangedKnuthElements(List oldList,
int alignment) {
log.warn("null implementation of getChangeKnuthElement() called!");
return null;
diff --git a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
index 0e6c2cb40..22d5fb941 100644
--- a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
@@ -189,7 +189,7 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager
}
/** {@inheritDoc} */
- public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
+ public List getNextKnuthElements(LayoutContext context, int alignment) {
resetSpaces();
if (isAbsoluteOrFixed()) {
return getNextKnuthElementsAbsolute(context, alignment);
@@ -247,9 +247,9 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager
MinOptMax stackLimit = new MinOptMax(relDims.bpd);
- LinkedList returnedList;
- LinkedList contentList = new LinkedList();
- LinkedList returnList = new LinkedList();
+ List returnedList;
+ List contentList = new LinkedList();
+ List returnList = new LinkedList();
if (!breakBeforeServed) {
try {
@@ -291,7 +291,7 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager
childLC.clearKeepWithPreviousPending();
}
if (returnedList.size() == 1
- && ((ListElement)returnedList.getFirst()).isForcedBreak()) {
+ && ((ListElement)returnedList.get(0)).isForcedBreak()) {
// a descendant of this block has break-before
/*
if (returnList.size() == 0) {
@@ -321,7 +321,8 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager
//Avoid NoSuchElementException below (happens with empty blocks)
continue;
}
- if (((ListElement)returnedList.getLast()).isForcedBreak()) {
+ if (((ListElement) returnedList
+ .get(returnedList.size() - 1)).isForcedBreak()) {
// a descendant of this block has break-after
if (curLM.isFinished()) {
// there is no other content in this block;
@@ -392,7 +393,7 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager
return returnList;
}
- private LinkedList getNextKnuthElementsAbsolute(LayoutContext context, int alignment) {
+ private List getNextKnuthElementsAbsolute(LayoutContext context, int alignment) {
autoHeight = false;
boolean switchedProgressionDirection
@@ -515,7 +516,7 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager
}
updateRelDims(0, 0, false);
}
- LinkedList returnList = new LinkedList();
+ List returnList = new LinkedList();
if (!breaker.isEmpty()) {
Position bcPosition = new BlockContainerPosition(this, breaker);
returnList.add(new KnuthBox(0, notifyPos(bcPosition), false));
@@ -622,9 +623,9 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager
return lc;
}
- protected LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
+ protected List getNextKnuthElements(LayoutContext context, int alignment) {
LayoutManager curLM; // currently active LM
- LinkedList returnList = new LinkedList();
+ List returnList = new LinkedList();
while ((curLM = getChildLM()) != null) {
LayoutContext childLC = new LayoutContext(0);
@@ -632,7 +633,7 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager
childLC.setRefIPD(context.getRefIPD());
childLC.setWritingMode(getBlockContainerFO().getWritingMode());
- LinkedList returnedList = null;
+ List returnedList = null;
if (!curLM.isFinished()) {
returnedList = curLM.getNextKnuthElements(childLC, alignment);
}
@@ -723,7 +724,7 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager
// "unwrap" the NonLeafPositions stored in parentIter
// and put them in a new list;
- LinkedList positionList = new LinkedList();
+ List positionList = new LinkedList();
Position pos;
boolean bSpaceBefore = false;
boolean bSpaceAfter = false;
@@ -798,10 +799,11 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager
// // the last item inside positionList is a Position;
// // this means that the paragraph has been split
// // between consecutive pages
- LinkedList splitList = new LinkedList();
+ List splitList = new LinkedList();
int splitLength = 0;
- int iFirst = ((MappingPosition) positionList.getFirst()).getFirstIndex();
- int iLast = ((MappingPosition) positionList.getLast()).getLastIndex();
+ int iFirst = ((MappingPosition) positionList.get(0)).getFirstIndex();
+ int iLast = ((MappingPosition) positionList.get(positionList
+ .size() - 1)).getLastIndex();
// copy from storedList to splitList all the elements from
// iFirst to iLast
ListIterator storedListIterator = storedList.listIterator(iFirst);
diff --git a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
index c5c7d9445..b6b6f921f 100644
--- a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
@@ -113,7 +113,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager
}
/** {@inheritDoc} */
- public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
+ public List getNextKnuthElements(LayoutContext context, int alignment) {
resetSpaces();
return super.getNextKnuthElements(context, alignment);
}
diff --git a/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
index b208e4e9b..b2fb98ccd 100644
--- a/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
@@ -63,7 +63,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
/** space-after value adjusted for block-progression-unit handling */
protected int adjustedSpaceAfter = 0;
/** Only used to store the original list when createUnitElements is called */
- protected LinkedList storedList = null;
+ protected List storedList = null;
/** Indicates whether break before has been served or not */
protected boolean breakBeforeServed = false;
/** Indicates whether the first visible mark has been returned by this LM, yet */
@@ -235,7 +235,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
}
/** {@inheritDoc} */
- public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
+ public List getNextKnuthElements(LayoutContext context, int alignment) {
//log.debug("BLM.getNextKnuthElements> keep-together = "
// + layoutProps.keepTogether.getType());
//log.debug(" keep-with-previous = " +
@@ -249,9 +249,9 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
updateContentAreaIPDwithOverconstrainedAdjust();
- LinkedList returnedList = null;
- LinkedList contentList = new LinkedList();
- LinkedList returnList = new LinkedList();
+ List returnedList = null;
+ List contentList = new LinkedList();
+ List returnList = new LinkedList();
if (!breakBeforeServed) {
try {
@@ -303,11 +303,11 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
}
if (returnedList != null
&& returnedList.size() == 1
- && ((ListElement) returnedList.getFirst()).isForcedBreak()) {
+ && ((ListElement) returnedList.get(0)).isForcedBreak()) {
if (curLM.isFinished() && !hasNextChildLM()) {
// a descendant of this block has break-before
- forcedBreakAfterLast = (BreakElement) returnedList.getFirst();
+ forcedBreakAfterLast = (BreakElement) returnedList.get(0);
context.clearPendingMarks();
break;
}
@@ -344,10 +344,12 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
continue;
}
contentList.addAll(returnedList);
- if (((ListElement) returnedList.getLast()).isForcedBreak()) {
+ if (((ListElement) returnedList.get(returnedList.size() - 1))
+ .isForcedBreak()) {
// a descendant of this block has break-after
if (curLM.isFinished() && !hasNextChildLM()) {
- forcedBreakAfterLast = (BreakElement)contentList.removeLast();
+ forcedBreakAfterLast = (BreakElement) contentList
+ .remove(contentList.size() - 1);
context.clearPendingMarks();
break;
}
@@ -414,7 +416,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
* @param context the current layout context
* @param childLC the currently active child layout context
*/
- protected void addInBetweenBreak(LinkedList contentList, LayoutContext context,
+ protected void addInBetweenBreak(List contentList, LayoutContext context,
LayoutContext childLC) {
if (mustKeepTogether()
|| context.isKeepWithNextPending()
@@ -438,7 +440,8 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
return;
}
- ListElement last = (ListElement)contentList.getLast();
+ ListElement last = (ListElement) contentList
+ .get(contentList.size() - 1);
if (last.isGlue()) {
// the last element in contentList is a glue;
// it is a feasible breakpoint, there is no need to add
@@ -585,7 +588,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
/**
* {@inheritDoc}
*/
- public LinkedList getChangedKnuthElements(List oldList, int alignment) {
+ public List getChangedKnuthElements(List oldList, int alignment) {
/*LF*/ //log.debug("");
/*LF*/ //log.debug(" BLM.getChangedKnuthElements> inizio: oldList.size() = "
// + oldList.size());
@@ -593,8 +596,8 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
KnuthElement returnedElement;
KnuthElement currElement = null;
KnuthElement prevElement = null;
- LinkedList returnedList = new LinkedList();
- LinkedList returnList = new LinkedList();
+ List returnedList = new LinkedList();
+ List returnList = new LinkedList();
int fromIndex = 0;
// "unwrap" the Positions stored in the elements
@@ -691,7 +694,9 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
// add an infinite penalty to forbid a break between blocks
returnedList.add(new KnuthPenalty(0, KnuthElement.INFINITE, false,
new Position(this), false));
- } else if (bSomethingAdded && !((KnuthElement) returnedList.getLast()).isGlue()) {
+ } else if (bSomethingAdded
+ && !((KnuthElement) returnedList.get(returnedList
+ .size() - 1)).isGlue()) {
// add a null penalty to allow a break between blocks
returnedList.add(new KnuthPenalty(0, 0, false, new Position(this), false));
}
@@ -711,7 +716,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
// there are no more elements to add
// remove the last penalty added to returnedList
if (returnedList.size() > 0) {
- returnedList.removeLast();
+ returnedList.remove(returnedList.size() - 1);
}
//log.debug(" BLM.getChangedKnuthElements> elementi propri, ignorati, da "
// + fromIndex + " a " + workList.size());
@@ -943,7 +948,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
* @param isFirst true if this is the first time a layout manager instance needs to generate
* border and padding
*/
- protected void addKnuthElementsForBorderPaddingBefore(LinkedList returnList, boolean isFirst) {
+ protected void addKnuthElementsForBorderPaddingBefore(List returnList, boolean isFirst) {
//Border and Padding (before)
CommonBorderPaddingBackground borderAndPadding = getBorderPaddingBackground();
if (borderAndPadding != null) {
@@ -970,7 +975,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
* @param isLast true if this is the last time a layout manager instance needs to generate
* border and padding
*/
- protected void addKnuthElementsForBorderPaddingAfter(LinkedList returnList, boolean isLast) {
+ protected void addKnuthElementsForBorderPaddingAfter(List returnList, boolean isLast) {
//Border and Padding (after)
CommonBorderPaddingBackground borderAndPadding = getBorderPaddingBackground();
if (borderAndPadding != null) {
@@ -997,7 +1002,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
* @param context the layout context
* @return true if an element has been added due to a break-before.
*/
- protected boolean addKnuthElementsForBreakBefore(LinkedList returnList,
+ protected boolean addKnuthElementsForBreakBefore(List returnList,
LayoutContext context) {
int breakBefore = -1;
if (fobj instanceof org.apache.fop.fo.flow.Block) {
@@ -1030,7 +1035,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
* @param context the layout context
* @return true if an element has been added due to a break-after.
*/
- protected boolean addKnuthElementsForBreakAfter(LinkedList returnList,
+ protected boolean addKnuthElementsForBreakAfter(List returnList,
LayoutContext context) {
int breakAfter = -1;
if (fobj instanceof org.apache.fop.fo.flow.Block) {
@@ -1062,7 +1067,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
* @param returnList return list to add the additional elements to
* @param alignment vertical alignment
*/
- protected void addKnuthElementsForSpaceBefore(LinkedList returnList/*,
+ protected void addKnuthElementsForSpaceBefore(List returnList/*,
Position returnPosition*/, int alignment) {
SpaceProperty spaceBefore = getSpaceBeforeProperty();
// append elements representing space-before
@@ -1111,7 +1116,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
* @param returnList return list to add the additional elements to
* @param alignment vertical alignment
*/
- protected void addKnuthElementsForSpaceAfter(LinkedList returnList/*, Position returnPosition*/,
+ protected void addKnuthElementsForSpaceAfter(List returnList/*, Position returnPosition*/,
int alignment) {
SpaceProperty spaceAfter = getSpaceAfterProperty();
// append elements representing space-after
@@ -1156,22 +1161,22 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
}*/
}
- protected LinkedList createUnitElements(LinkedList oldList) {
+ protected List createUnitElements(List oldList) {
//log.debug("Start conversion: " + oldList.size()
// + " elements, space-before.min=" + layoutProps.spaceBefore.getSpace().min
// + " space-after.min=" + layoutProps.spaceAfter.getSpace().min);
// add elements at the beginning and at the end of oldList
// representing minimum spaces
- LayoutManager lm = ((KnuthElement)oldList.getFirst()).getLayoutManager();
+ LayoutManager lm = ((KnuthElement)oldList.get(0)).getLayoutManager();
boolean bAddedBoxBefore = false;
boolean bAddedBoxAfter = false;
if (adjustedSpaceBefore > 0) {
- oldList.addFirst(new KnuthBox(adjustedSpaceBefore,
+ oldList.add(0, new KnuthBox(adjustedSpaceBefore,
new Position(lm), true));
bAddedBoxBefore = true;
}
if (adjustedSpaceAfter > 0) {
- oldList.addLast(new KnuthBox(adjustedSpaceAfter,
+ oldList.add(new KnuthBox(adjustedSpaceAfter,
new Position(lm), true));
bAddedBoxAfter = true;
}
@@ -1399,10 +1404,10 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager
// remove elements at the beginning and at the end of oldList
// representing minimum spaces
if (adjustedSpaceBefore > 0) {
- oldList.removeFirst();
+ oldList.remove(0);
}
if (adjustedSpaceAfter > 0) {
- oldList.removeLast();
+ oldList.remove(oldList.size() - 1);
}
// if space-before.conditionality is "discard", correct newList
diff --git a/src/java/org/apache/fop/layoutmgr/ElementListUtils.java b/src/java/org/apache/fop/layoutmgr/ElementListUtils.java
index 9a87e71c4..f3d36276c 100644
--- a/src/java/org/apache/fop/layoutmgr/ElementListUtils.java
+++ b/src/java/org/apache/fop/layoutmgr/ElementListUtils.java
@@ -38,7 +38,7 @@ public class ElementListUtils {
* @param constraint min/opt/max value to restrict the range in which the breaks are removed.
* @return true if the opt constraint is bigger than the list contents
*/
- public static boolean removeLegalBreaks(LinkedList elements, MinOptMax constraint) {
+ public static boolean removeLegalBreaks(List elements, MinOptMax constraint) {
return removeLegalBreaks(elements, constraint.opt);
}
@@ -50,7 +50,7 @@ public class ElementListUtils {
* @param constraint value to restrict the range in which the breaks are removed.
* @return true if the constraint is bigger than the list contents
*/
- public static boolean removeLegalBreaks(LinkedList elements, int constraint) {
+ public static boolean removeLegalBreaks(List elements, int constraint) {
int len = 0;
ListIterator iter = elements.listIterator();
while (iter.hasNext()) {
@@ -97,7 +97,7 @@ public class ElementListUtils {
* @param constraint value to restrict the range in which the breaks are removed.
* @return true if the constraint is bigger than the list contents
*/
- public static boolean removeLegalBreaksFromEnd(LinkedList elements, int constraint) {
+ public static boolean removeLegalBreaksFromEnd(List elements, int constraint) {
int len = 0;
ListIterator i = elements.listIterator(elements.size());
while (i.hasPrevious()) {
@@ -184,8 +184,8 @@ public class ElementListUtils {
* @param elems the element list
* @return true if the list ends with a forced break
*/
- public static boolean endsWithForcedBreak(LinkedList elems) {
- ListElement last = (ListElement)elems.getLast();
+ public static boolean endsWithForcedBreak(List elems) {
+ ListElement last = (ListElement) elems.get(elems.size() - 1);
return last.isForcedBreak();
}
@@ -195,8 +195,8 @@ public class ElementListUtils {
* @param elems the element list
* @return true if the list ends with a non-infinite penalty
*/
- public static boolean endsWithNonInfinitePenalty(LinkedList elems) {
- ListElement last = (ListElement)elems.getLast();
+ public static boolean endsWithNonInfinitePenalty(List elems) {
+ ListElement last = (ListElement) elems.get(elems.size() - 1);
if (last.isPenalty() && ((KnuthPenalty)last).getP() < KnuthElement.INFINITE) {
return true;
} else if (last instanceof BreakElement
diff --git a/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java b/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
index 9cd5c622d..2410c19cd 100644
--- a/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
@@ -64,7 +64,7 @@ public class FlowLayoutManager extends BlockStackingLayoutManager
}
/** {@inheritDoc} */
- public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
+ public List getNextKnuthElements(LayoutContext context, int alignment) {
// set layout dimensions
int flowIPD = getCurrentPV().getCurrentSpan().getColumnWidth();
@@ -72,8 +72,8 @@ public class FlowLayoutManager extends BlockStackingLayoutManager
// currently active LM
LayoutManager curLM;
- LinkedList returnedList;
- LinkedList returnList = new LinkedList();
+ List returnedList;
+ List returnList = new LinkedList();
while ((curLM = getChildLM()) != null) {
if (!(curLM instanceof WrapperLayoutManager)
@@ -114,7 +114,7 @@ public class FlowLayoutManager extends BlockStackingLayoutManager
}
// "wrap" the Position inside each element
- LinkedList tempList = returnedList;
+ List tempList = returnedList;
returnedList = new LinkedList();
wrapPositionElements(tempList, returnedList);
@@ -213,11 +213,11 @@ public class FlowLayoutManager extends BlockStackingLayoutManager
}
/** {@inheritDoc} */
- public LinkedList getChangedKnuthElements(List oldList, /*int flaggedPenalty,*/ int alignment) {
+ public List getChangedKnuthElements(List oldList, /*int flaggedPenalty,*/ int alignment) {
ListIterator oldListIterator = oldList.listIterator();
KnuthElement returnedElement;
- LinkedList returnedList = new LinkedList();
- LinkedList returnList = new LinkedList();
+ List returnedList = new LinkedList();
+ List returnList = new LinkedList();
KnuthElement prevElement = null;
KnuthElement currElement = null;
int fromIndex = 0;
@@ -257,7 +257,8 @@ public class FlowLayoutManager extends BlockStackingLayoutManager
// add an infinite penalty to forbid a break between blocks
returnedList.add(new KnuthPenalty(0, KnuthElement.INFINITE, false,
new Position(this), false));
- } else if (!((KnuthElement) returnedList.getLast()).isGlue()) {
+ } else if (!((KnuthElement) returnedList.get(returnedList
+ .size() - 1)).isGlue()) {
// add a null penalty to allow a break between blocks
returnedList.add(new KnuthPenalty(0, 0, false, new Position(this), false));
}
diff --git a/src/java/org/apache/fop/layoutmgr/KnuthBlockBox.java b/src/java/org/apache/fop/layoutmgr/KnuthBlockBox.java
index 53f285377..364c896ad 100644
--- a/src/java/org/apache/fop/layoutmgr/KnuthBlockBox.java
+++ b/src/java/org/apache/fop/layoutmgr/KnuthBlockBox.java
@@ -19,9 +19,10 @@
package org.apache.fop.layoutmgr;
-import org.apache.fop.traits.MinOptMax;
-
import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.fop.traits.MinOptMax;
/**
* Knuth box used to represent a line in block-progression-dimension (i.e. the width is its height).
@@ -34,9 +35,9 @@ public class KnuthBlockBox extends KnuthBox {
* it isn't possible to get the opt value stored in a MinOptMax object.
*/
private int bpd;
- private LinkedList footnoteList;
+ private List footnoteList;
/** List of Knuth elements. This is a list of LinkedList elements. */
- private LinkedList elementLists = null;
+ private List elementLists = null;
/**
* Creates a new box.
@@ -61,7 +62,7 @@ public class KnuthBlockBox extends KnuthBox {
* @param pos the Position stored in this box
* @param bAux is this box auxiliary?
*/
- public KnuthBlockBox(int w, LinkedList list, Position pos, boolean bAux) {
+ public KnuthBlockBox(int w, List list, Position pos, boolean bAux) {
super(w, pos, bAux);
ipdRange = new MinOptMax(0);
bpd = 0;
@@ -71,7 +72,7 @@ public class KnuthBlockBox extends KnuthBox {
/**
* @return the LMs for the footnotes cited in this box.
*/
- public LinkedList getFootnoteBodyLMs() {
+ public List getFootnoteBodyLMs() {
return footnoteList;
}
@@ -86,7 +87,7 @@ public class KnuthBlockBox extends KnuthBox {
* Adds the given list of Knuth elements to this box' list of elements.
* @param list elements corresponding to a footnote body
*/
- public void addElementList(LinkedList list) {
+ public void addElementList(List list) {
if (elementLists == null) {
elementLists = new LinkedList();
}
@@ -98,7 +99,7 @@ public class KnuthBlockBox extends KnuthBox {
* @return a list of KnuthElement sequences corresponding to footnotes cited in this
* box
*/
- public LinkedList getElementLists() {
+ public List getElementLists() {
return elementLists;
}
diff --git a/src/java/org/apache/fop/layoutmgr/LayoutManager.java b/src/java/org/apache/fop/layoutmgr/LayoutManager.java
index 0b17c9a27..0700ea43a 100644
--- a/src/java/org/apache/fop/layoutmgr/LayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/LayoutManager.java
@@ -19,7 +19,6 @@
package org.apache.fop.layoutmgr;
-import java.util.LinkedList;
import java.util.List;
import org.apache.fop.area.Area;
@@ -138,7 +137,7 @@ public interface LayoutManager extends PercentBaseContext {
* @param alignment the desired text alignement
* @return the list of KnuthElements
*/
- LinkedList getNextKnuthElements(LayoutContext context, int alignment);
+ List getNextKnuthElements(LayoutContext context, int alignment);
/**
* Get a sequence of KnuthElements representing the content
@@ -175,7 +174,7 @@ public interface LayoutManager extends PercentBaseContext {
* @param alignment the desired text alignment
* @return the updated list of KnuthElements
*/
- LinkedList getChangedKnuthElements(List oldList, int alignment);
+ List getChangedKnuthElements(List oldList, int alignment);
/**
* Returns the IPD of the content area
diff --git a/src/java/org/apache/fop/layoutmgr/PageBreaker.java b/src/java/org/apache/fop/layoutmgr/PageBreaker.java
index d6be75758..b25e4bd4f 100644
--- a/src/java/org/apache/fop/layoutmgr/PageBreaker.java
+++ b/src/java/org/apache/fop/layoutmgr/PageBreaker.java
@@ -135,8 +135,8 @@ public class PageBreaker extends AbstractBreaker {
}
/** {@inheritDoc} */
- protected LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
- LinkedList contentList = null;
+ protected List getNextKnuthElements(LayoutContext context, int alignment) {
+ List contentList = null;
while (!childFLM.isFinished() && contentList == null) {
contentList = childFLM.getNextKnuthElements(context, alignment);
@@ -156,7 +156,7 @@ public class PageBreaker extends AbstractBreaker {
footnoteContext.setStackLimitBP(context.getStackLimitBP());
footnoteContext.setRefIPD(pslm.getCurrentPV()
.getRegionReference(Constants.FO_REGION_BODY).getIPD());
- LinkedList footnoteBodyLMs = ((KnuthBlockBox) element).getFootnoteBodyLMs();
+ List footnoteBodyLMs = ((KnuthBlockBox) element).getFootnoteBodyLMs();
ListIterator footnoteBodyIterator = footnoteBodyLMs.listIterator();
// store the lists of elements representing the footnote bodies
// in the box representing the line containing their references
diff --git a/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java b/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
index 5e3d0a887..a3155e102 100644
--- a/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
+++ b/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
@@ -21,11 +21,11 @@ package org.apache.fop.layoutmgr;
import java.util.ArrayList;
import java.util.LinkedList;
+import java.util.List;
import java.util.ListIterator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.FObj;
import org.apache.fop.layoutmgr.AbstractBreaker.PageBreakPosition;
@@ -230,7 +230,7 @@ class PageBreakingAlgorithm extends BreakingAlgorithm {
* @param elementLists list of KnuthElement sequences corresponding to the footnotes
* bodies
*/
- private void handleFootnotes(LinkedList elementLists) {
+ private void handleFootnotes(List elementLists) {
// initialization
if (!footnotesPending) {
footnotesPending = true;
@@ -286,7 +286,7 @@ class PageBreakingAlgorithm extends BreakingAlgorithm {
return returnValue;
}
- private void resetFootnotes(LinkedList elementLists) {
+ private void resetFootnotes(List elementLists) {
for (int i = 0; i < elementLists.size(); i++) {
/*LinkedList removedList = (LinkedList)*/footnotesList.remove(footnotesList.size() - 1);
lengthList.remove(lengthList.size() - 1);
diff --git a/src/java/org/apache/fop/layoutmgr/SpaceResolver.java b/src/java/org/apache/fop/layoutmgr/SpaceResolver.java
index 58de6a980..051f76d7f 100644
--- a/src/java/org/apache/fop/layoutmgr/SpaceResolver.java
+++ b/src/java/org/apache/fop/layoutmgr/SpaceResolver.java
@@ -614,7 +614,7 @@ public class SpaceResolver {
* Resolves unresolved elements applying the space resolution rules defined in 4.3.1.
* @param elems the element list
*/
- public static void resolveElementList(LinkedList elems) {
+ public static void resolveElementList(List elems) {
if (log.isTraceEnabled()) {
log.trace(elems);
}
diff --git a/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java b/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
index 8065f9aad..3a8786bd7 100644
--- a/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
@@ -87,7 +87,7 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager {
}
/** {@inheritDoc} */
- public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
+ public List getNextKnuthElements(LayoutContext context, int alignment) {
if (true) {
throw new UnsupportedOperationException(
"Shouldn't this method be emptied because it's never called at all?");
@@ -102,8 +102,8 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager {
BlockLevelLayoutManager curLM;
BlockLevelLayoutManager prevLM = null;
MinOptMax stackSize = new MinOptMax();
- LinkedList returnedList;
- LinkedList returnList = new LinkedList();
+ List returnedList;
+ List returnList = new LinkedList();
while ((curLM = ((BlockLevelLayoutManager) getChildLM())) != null) {
if (curLM instanceof InlineLevelLayoutManager) {
@@ -125,7 +125,7 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager {
// + returnedList.size());
// "wrap" the Position inside each element
- LinkedList tempList = returnedList;
+ List tempList = returnedList;
KnuthElement tempElement;
returnedList = new LinkedList();
ListIterator listIter = tempList.listIterator();
@@ -136,8 +136,8 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager {
}
if (returnedList.size() == 1
- && ((KnuthElement)returnedList.getFirst()).isPenalty()
- && ((KnuthPenalty)returnedList.getFirst()).getP() == -KnuthElement.INFINITE) {
+ && ((KnuthElement)returnedList.get(0)).isPenalty()
+ && ((KnuthPenalty)returnedList.get(0)).getP() == -KnuthElement.INFINITE) {
// a descendant of this flow has break-before
returnList.addAll(returnedList);
return returnList;
@@ -150,16 +150,18 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager {
returnList.add(new KnuthPenalty(0,
KnuthElement.INFINITE, false,
new Position(this), false));
- } else if (!((KnuthElement) returnList.getLast()).isGlue()) {
+ } else if (!((KnuthElement) returnList.get(returnList
+ .size() - 1)).isGlue()) {
// add a null penalty to allow a break between blocks
returnList.add(new KnuthPenalty(0, 0, false, new Position(this), false));
}
}
/*LF*/ if (returnedList.size() > 0) { // controllare!
returnList.addAll(returnedList);
- if (((KnuthElement)returnedList.getLast()).isPenalty()
- && ((KnuthPenalty)returnedList.getLast()).getP()
- == -KnuthElement.INFINITE) {
+ final KnuthElement last = (KnuthElement) returnedList
+ .get(returnedList.size() - 1);
+ if (last.isPenalty()
+ && ((KnuthPenalty) last).getP() == -KnuthElement.INFINITE) {
// a descendant of this flow has break-after
/*LF*/ //log.debug("FLM - break after!!");
return returnList;
@@ -325,9 +327,9 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager {
return lc;
}
- protected LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
+ protected List getNextKnuthElements(LayoutContext context, int alignment) {
LayoutManager curLM; // currently active LM
- LinkedList returnList = new LinkedList();
+ List returnList = new LinkedList();
while ((curLM = getChildLM()) != null) {
LayoutContext childLC = new LayoutContext(0);
@@ -335,7 +337,7 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager {
childLC.setRefIPD(context.getRefIPD());
childLC.setWritingMode(context.getWritingMode());
- LinkedList returnedList = null;
+ List returnedList = null;
//The following is a HACK! Ignore leading and trailing white space
boolean ignore = curLM instanceof TextLayoutManager;
if (!curLM.isFinished()) {
diff --git a/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java
index 38e0c35bc..e90927699 100644
--- a/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java
@@ -21,7 +21,7 @@ package org.apache.fop.layoutmgr.inline;
import java.awt.Dimension;
import java.awt.Rectangle;
-import java.util.LinkedList;
+import java.util.List;
import org.apache.fop.area.Area;
import org.apache.fop.area.inline.Viewport;
@@ -104,7 +104,7 @@ public abstract class AbstractGraphicsLayoutManager extends LeafNodeLayoutManage
}
/** {@inheritDoc} */
- public LinkedList getNextKnuthElements(LayoutContext context,
+ public List getNextKnuthElements(LayoutContext context,
int alignment) {
Viewport areaCurrent = getInlineArea();
setCurrentArea(areaCurrent);
diff --git a/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java
index a6f9be7af..c81a23a9c 100644
--- a/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java
@@ -90,7 +90,7 @@ public class CharacterLayoutManager extends LeafNodeLayoutManager {
}
/** {@inheritDoc} */
- public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
+ public List getNextKnuthElements(LayoutContext context, int alignment) {
MinOptMax ipd;
curArea = get(context);
KnuthSequence seq = new InlineKnuthSequence();
@@ -179,7 +179,7 @@ public class CharacterLayoutManager extends LeafNodeLayoutManager {
}
/** {@inheritDoc} */
- public LinkedList getChangedKnuthElements(List oldList, int alignment) {
+ public List getChangedKnuthElements(List oldList, int alignment) {
if (isFinished()) {
return null;
}
diff --git a/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java
index 2af844c5c..b43c4c841 100644
--- a/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java
@@ -27,8 +27,6 @@ import java.util.ListIterator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
-import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.area.Area;
import org.apache.fop.area.Block;
import org.apache.fop.area.LineArea;
@@ -131,7 +129,7 @@ public class ContentLayoutManager extends AbstractBaseLayoutManager
stackSize = 0;
- LinkedList contentList =
+ List contentList =
getNextKnuthElements(childLC, Constants.EN_START);
ListIterator contentIter = contentList.listIterator();
while (contentIter.hasNext()) {
@@ -254,9 +252,9 @@ public class ContentLayoutManager extends AbstractBaseLayoutManager
}
}
- public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
- LinkedList contentList = new LinkedList();
- LinkedList returnedList;
+ public List getNextKnuthElements(LayoutContext context, int alignment) {
+ List contentList = new LinkedList();
+ List returnedList;
childLM.initialize();
while (!childLM.isFinished()) {
@@ -267,7 +265,7 @@ public class ContentLayoutManager extends AbstractBaseLayoutManager
// move elements to contentList, and accumulate their size
KnuthElement contentElement;
while (returnedList.size() > 0) {
- Object obj = returnedList.removeFirst();
+ Object obj = returnedList.remove(0);
if (obj instanceof KnuthSequence) {
KnuthSequence ks = (KnuthSequence)obj;
for (Iterator it = ks.iterator(); it.hasNext(); ) {
@@ -312,7 +310,7 @@ public class ContentLayoutManager extends AbstractBaseLayoutManager
return false;
}
- public LinkedList getChangedKnuthElements(List oldList,
+ public List getChangedKnuthElements(List oldList,
/*int flaggedPenalty,*/
int alignment) {
return null;
diff --git a/src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java
index adb0e5a73..a02cfee89 100644
--- a/src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java
@@ -71,7 +71,7 @@ public class FootnoteLayoutManager extends InlineStackingLayoutManager {
}
/** {@inheritDoc} */
- public LinkedList getNextKnuthElements(LayoutContext context,
+ public List getNextKnuthElements(LayoutContext context,
int alignment) {
// for the moment, this LM is set as the citationLM's parent
// later on, when this LM will have nothing more to do, the citationLM's parent
@@ -82,9 +82,9 @@ public class FootnoteLayoutManager extends InlineStackingLayoutManager {
bodyLM.initialize();
// get Knuth elements representing the footnote citation
- LinkedList returnedList = new LinkedList();
+ List returnedList = new LinkedList();
while (!citationLM.isFinished()) {
- LinkedList partialList = citationLM.getNextKnuthElements(context, alignment);
+ List partialList = citationLM.getNextKnuthElements(context, alignment);
if (partialList != null) {
returnedList.addAll(partialList);
}
@@ -122,9 +122,9 @@ public class FootnoteLayoutManager extends InlineStackingLayoutManager {
/**
* {@inheritDoc}
*/
- public LinkedList getChangedKnuthElements(List oldList,
+ public List getChangedKnuthElements(List oldList,
int alignment) {
- LinkedList returnedList = super.getChangedKnuthElements(oldList, alignment);
+ List returnedList = super.getChangedKnuthElements(oldList, alignment);
addAnchor(returnedList);
return returnedList;
}
@@ -164,7 +164,7 @@ public class FootnoteLayoutManager extends InlineStackingLayoutManager {
* Find the last box in the sequence, and add a reference to the FootnoteBodyLM
* @param citationList the list of elements representing the footnote citation
*/
- private void addAnchor(LinkedList citationList) {
+ private void addAnchor(List citationList) {
KnuthInlineBox lastBox = null;
// the list of elements is searched backwards, until we find a box
ListIterator citationIterator = citationList.listIterator(citationList.size());
diff --git a/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java
index 7c2e4748a..123259cd4 100755
--- a/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java
@@ -233,14 +233,14 @@ public class InlineLayoutManager extends InlineStackingLayoutManager {
}
/** {@inheritDoc} */
- public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
+ public List getNextKnuthElements(LayoutContext context, int alignment) {
LayoutManager curLM;
// the list returned by child LM
- LinkedList returnedList;
+ List returnedList;
// the list which will be returned to the parent LM
- LinkedList returnList = new LinkedList();
+ List returnList = new LinkedList();
KnuthSequence lastSequence = null;
SpaceSpecifier leadingSpace = context.getLeadingSpace();
@@ -367,7 +367,8 @@ public class InlineLayoutManager extends InlineStackingLayoutManager {
context.updateKeepWithNextPending(childLC.getKeepWithNextPending());
childLC.clearKeepsPending();
}
- lastSequence = (KnuthSequence) returnList.getLast();
+ lastSequence = (KnuthSequence) returnList
+ .get(returnList.size() - 1);
lastChildLM = curLM;
}
@@ -432,7 +433,7 @@ public class InlineLayoutManager extends InlineStackingLayoutManager {
// set in the layout context, it must be also set in the
// layout context given to lastLM, but must be cleared in the
// layout context given to the other LMs.
- LinkedList positionList = new LinkedList();
+ List positionList = new LinkedList();
NonLeafPosition pos;
LayoutManager lastLM = null;// last child LM in this iterator
Position lastPos = null;
@@ -533,8 +534,8 @@ public class InlineLayoutManager extends InlineStackingLayoutManager {
}
/** {@inheritDoc} */
- public LinkedList getChangedKnuthElements(List oldList, int alignment) {
- LinkedList returnedList = new LinkedList();
+ public List getChangedKnuthElements(List oldList, int alignment) {
+ List returnedList = new LinkedList();
addKnuthElementsForBorderPaddingStart(returnedList);
returnedList.addAll(super.getChangedKnuthElements(oldList, alignment));
addKnuthElementsForBorderPaddingEnd(returnedList);
diff --git a/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java
index bf1538a7c..81fc7901d 100644
--- a/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java
@@ -364,7 +364,7 @@ public abstract class InlineStackingLayoutManager extends AbstractLayoutManager
/**
* {@inheritDoc}
*/
- public LinkedList getChangedKnuthElements(List oldList, int alignment) {
+ public List getChangedKnuthElements(List oldList, int alignment) {
// "unwrap" the Positions stored in the elements
ListIterator oldListIterator = oldList.listIterator();
KnuthElement oldElement;
diff --git a/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java
index 1e7c793df..3bb82aa11 100644
--- a/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java
@@ -52,7 +52,7 @@ public class LeaderLayoutManager extends LeafNodeLayoutManager {
private Leader fobj;
private Font font = null;
- private LinkedList contentList = null;
+ private List contentList = null;
private ContentLayoutManager clm = null;
private int contentAreaIPD = 0;
@@ -230,7 +230,7 @@ public class LeaderLayoutManager extends LeafNodeLayoutManager {
}
/** {@inheritDoc} */
- public LinkedList getNextKnuthElements(LayoutContext context,
+ public List getNextKnuthElements(LayoutContext context,
int alignment) {
MinOptMax ipd;
curArea = get(context);
@@ -305,13 +305,13 @@ public class LeaderLayoutManager extends LeafNodeLayoutManager {
}
/** {@inheritDoc} */
- public LinkedList getChangedKnuthElements(List oldList,
+ public List getChangedKnuthElements(List oldList,
int alignment) {
if (isFinished()) {
return null;
}
- LinkedList returnList = new LinkedList();
+ List returnList = new LinkedList();
addKnuthElementsForBorderPaddingStart(returnList);
diff --git a/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java
index fb5e9ee4d..552e74889 100644
--- a/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java
@@ -249,7 +249,7 @@ public abstract class LeafNodeLayoutManager extends AbstractLayoutManager
}
/** {@inheritDoc} */
- public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
+ public List getNextKnuthElements(LayoutContext context, int alignment) {
curArea = get(context);
if (curArea == null) {
@@ -313,7 +313,7 @@ public abstract class LeafNodeLayoutManager extends AbstractLayoutManager
}
/** {@inheritDoc} */
- public LinkedList getChangedKnuthElements(List oldList,
+ public List getChangedKnuthElements(List oldList,
int alignment) {
if (isFinished()) {
return null;
diff --git a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
index c9f72e64f..b77f36f0d 100644
--- a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
@@ -574,7 +574,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager
}
/** {@inheritDoc} */
- public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
+ public List getNextKnuthElements(LayoutContext context, int alignment) {
FontInfo fi = fobj.getFOEventHandler().getFontInfo();
FontTriplet[] fontkeys = fobj.getCommonFont().getFontState(fi);
Font fs = fi.getFontInstance(fontkeys[0], fobj.getCommonFont().fontSize.getValue(this));
@@ -644,7 +644,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager
LayoutContext inlineLC = new LayoutContext(context);
InlineLevelLayoutManager curLM;
- LinkedList returnedList = null;
+ List returnedList = null;
iLineWidth = context.getStackLimitIP().opt;
// convert all the text in a sequence of paragraphs made
@@ -666,7 +666,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager
}
if (lastPar != null) {
- KnuthSequence firstSeq = (KnuthSequence) returnedList.getFirst();
+ KnuthSequence firstSeq = (KnuthSequence) returnedList.get(0);
// finish last paragraph before a new block sequence
if (!firstSeq.isInlineSequence()) {
@@ -901,7 +901,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager
* @param context the layout context
* @return a list of Knuth elements representing broken lines
*/
- private LinkedList createLineBreaks(int alignment, LayoutContext context) {
+ private List createLineBreaks(int alignment, LayoutContext context) {
// find the optimal line breaking points for each paragraph
ListIterator paragraphsIterator
@@ -1048,9 +1048,9 @@ public class LineLayoutManager extends InlineStackingLayoutManager
* @param context the layout context
* @return the newly built element list
*/
- private LinkedList postProcessLineBreaks(int alignment, LayoutContext context) {
+ private List postProcessLineBreaks(int alignment, LayoutContext context) {
- LinkedList returnList = new LinkedList();
+ List returnList = new LinkedList();
for (int p = 0; p < knuthParagraphs.size(); p++) {
// penalty between paragraphs
@@ -1068,7 +1068,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager
KnuthSequence seq = (KnuthSequence) knuthParagraphs.get(p);
if (!seq.isInlineSequence()) {
- LinkedList targetList = new LinkedList();
+ List targetList = new LinkedList();
ListIterator listIter = seq.listIterator();
while (listIter.hasNext()) {
ListElement tempElement;
@@ -1110,7 +1110,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager
= ((LineBreakPosition) llPoss.getChosenPosition(i)).getLeafPos();
// create a list of the FootnoteBodyLM handling footnotes
// whose citations are in this line
- LinkedList footnoteList = new LinkedList();
+ List footnoteList = new LinkedList();
ListIterator elementIterator = seq.listIterator(startIndex);
while (elementIterator.nextIndex() <= endIndex) {
KnuthElement element = (KnuthElement) elementIterator.next();
@@ -1334,8 +1334,8 @@ public class LineLayoutManager extends InlineStackingLayoutManager
/**
* {@inheritDoc}
*/
- public LinkedList getChangedKnuthElements(List oldList, int alignment) {
- LinkedList returnList = new LinkedList();
+ public List getChangedKnuthElements(List oldList, int alignment) {
+ List returnList = new LinkedList();
for (int p = 0; p < knuthParagraphs.size(); p++) {
LineLayoutPossibilities llPoss;
llPoss = (LineLayoutPossibilities)lineLayoutsList.get(p);
@@ -1384,7 +1384,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager
ListIterator currParIterator
= currPar.listIterator(currPar.ignoreAtStart);
// list of TLM involved in hyphenation
- LinkedList updateList = new LinkedList();
+ List updateList = new LinkedList();
KnuthElement firstElement = null;
KnuthElement nextElement = null;
// current InlineLevelLayoutManager
@@ -1497,7 +1497,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager
.applyChanges(currPar.subList(fromIndex + iAddedElements,
toIndex + iAddedElements))) {
// insert the new KnuthElements
- LinkedList newElements = null;
+ List newElements = null;
newElements
= currUpdate.inlineLM.getChangedKnuthElements
(currPar.subList(fromIndex + iAddedElements,
diff --git a/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
index 903ec84ae..eec2b1e91 100644
--- a/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
@@ -523,12 +523,12 @@ public class TextLayoutManager extends LeafNodeLayoutManager {
}
/** {@inheritDoc} */
- public LinkedList getNextKnuthElements(final LayoutContext context, final int alignment) {
+ public List getNextKnuthElements(final LayoutContext context, final int alignment) {
this.lineStartBAP = context.getLineStartBorderAndPaddingWidth();
this.lineEndBAP = context.getLineEndBorderAndPaddingWidth();
this.alignmentContext = context.getAlignmentContext();
- final LinkedList returnList = new LinkedList();
+ final List returnList = new LinkedList();
KnuthSequence sequence = new InlineKnuthSequence();
AreaInfo ai = null;
AreaInfo prevAi = null;
@@ -624,9 +624,9 @@ public class TextLayoutManager extends LeafNodeLayoutManager {
sequence = this.processLinebreak(returnList, sequence);
}
- if (((List)returnList.getLast()).size() == 0) {
+ if (((List) returnList.get(returnList.size() - 1)).isEmpty()) {
//Remove an empty sequence because of a trailing newline
- returnList.removeLast();
+ returnList.remove(returnList.size() - 1);
}
this.setFinished(true);
@@ -637,7 +637,7 @@ public class TextLayoutManager extends LeafNodeLayoutManager {
}
}
- private KnuthSequence processLinebreak(final LinkedList returnList,
+ private KnuthSequence processLinebreak(final List returnList,
KnuthSequence sequence) {
if (this.lineEndBAP != 0) {
sequence.add(
@@ -942,7 +942,7 @@ public class TextLayoutManager extends LeafNodeLayoutManager {
}
/** {@inheritDoc} */
- public LinkedList getChangedKnuthElements(final List oldList,
+ public List getChangedKnuthElements(final List oldList,
final int alignment) {
if (this.isFinished()) {
return null;
diff --git a/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java b/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java
index dfffbdd04..11e69970e 100644
--- a/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java
@@ -115,9 +115,9 @@ public class ListBlockLayoutManager extends BlockStackingLayoutManager
}
/** {@inheritDoc} */
- public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
+ public List getNextKnuthElements(LayoutContext context, int alignment) {
resetSpaces();
- LinkedList returnList = super.getNextKnuthElements(context, alignment);
+ List returnList = super.getNextKnuthElements(context, alignment);
//fox:widow-content-limit
int widowRowLimit = getListBlockFO().getWidowContentLimit().getValue();
@@ -135,7 +135,7 @@ public class ListBlockLayoutManager extends BlockStackingLayoutManager
}
/** {@inheritDoc} */
- public LinkedList getChangedKnuthElements(List oldList, int alignment) {
+ public List getChangedKnuthElements(List oldList, int alignment) {
//log.debug("LBLM.getChangedKnuthElements>");
return super.getChangedKnuthElements(oldList, alignment);
}
diff --git a/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java b/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java
index 549244267..124827976 100644
--- a/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java
@@ -98,7 +98,7 @@ public class ListItemContentLayoutManager extends BlockStackingLayoutManager {
}
/** {@inheritDoc} */
- public LinkedList getChangedKnuthElements(List oldList, int alignment) {
+ public List getChangedKnuthElements(List oldList, int alignment) {
//log.debug(" ListItemContentLayoutManager.getChanged>");
return super.getChangedKnuthElements(oldList, alignment);
}
diff --git a/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java b/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
index 9d08415ff..37ec4964d 100644
--- a/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
@@ -72,8 +72,8 @@ public class ListItemLayoutManager extends BlockStackingLayoutManager
private Block curBlockArea = null;
- private LinkedList labelList = null;
- private LinkedList bodyList = null;
+ private List labelList = null;
+ private List bodyList = null;
private boolean discardBorderBefore;
private boolean discardBorderAfter;
@@ -190,11 +190,11 @@ public class ListItemLayoutManager extends BlockStackingLayoutManager
}
/** {@inheritDoc} */
- public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
+ public List getNextKnuthElements(LayoutContext context, int alignment) {
referenceIPD = context.getRefIPD();
LayoutContext childLC;
- LinkedList returnList = new LinkedList();
+ List returnList = new LinkedList();
if (!breakBeforeServed) {
try {
@@ -243,7 +243,7 @@ public class ListItemLayoutManager extends BlockStackingLayoutManager
this.keepWithNextPendingOnBody = childLC.getKeepWithNextPending();
// create a combined list
- LinkedList returnedList = getCombinedKnuthElementsForListItem(labelList, bodyList, context);
+ List returnedList = getCombinedKnuthElementsForListItem(labelList, bodyList, context);
// "wrap" the Position inside each element
wrapPositionElements(returnedList, returnList, true);
@@ -262,10 +262,9 @@ public class ListItemLayoutManager extends BlockStackingLayoutManager
return returnList;
}
- private LinkedList getCombinedKnuthElementsForListItem(LinkedList labelElements,
- LinkedList bodyElements,
- LayoutContext context) {
- //Copy elements to array lists to improve element access performance
+ private List getCombinedKnuthElementsForListItem(List labelElements,
+ List bodyElements, LayoutContext context) {
+ // Copy elements to array lists to improve element access performance
List[] elementLists = {new ArrayList(labelElements),
new ArrayList(bodyElements)};
int[] fullHeights = {ElementListUtils.calcContentLength(elementLists[0]),
@@ -429,7 +428,7 @@ public class ListItemLayoutManager extends BlockStackingLayoutManager
/**
* {@inheritDoc}
*/
- public LinkedList getChangedKnuthElements(List oldList, int alignment) {
+ public List getChangedKnuthElements(List oldList, int alignment) {
//log.debug(" LILM.getChanged> label");
// label
labelList = label.getChangedKnuthElements(labelList, alignment);
@@ -458,9 +457,9 @@ public class ListItemLayoutManager extends BlockStackingLayoutManager
}
}
- LinkedList returnedList = body.getChangedKnuthElements(oldList, alignment);
+ List returnedList = body.getChangedKnuthElements(oldList, alignment);
// "wrap" the Position inside each element
- LinkedList tempList = returnedList;
+ List tempList = returnedList;
KnuthElement tempElement;
returnedList = new LinkedList();
ListIterator listIter = tempList.listIterator();
diff --git a/src/java/org/apache/fop/layoutmgr/table/RowGroupLayoutManager.java b/src/java/org/apache/fop/layoutmgr/table/RowGroupLayoutManager.java
index 19b97322c..50688dd0e 100644
--- a/src/java/org/apache/fop/layoutmgr/table/RowGroupLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/table/RowGroupLayoutManager.java
@@ -21,10 +21,10 @@ package org.apache.fop.layoutmgr.table;
import java.util.Iterator;
import java.util.LinkedList;
+import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.flow.table.EffRow;
import org.apache.fop.fo.flow.table.GridUnit;
@@ -116,7 +116,7 @@ class RowGroupLayoutManager {
childLC.setRefIPD(spanWidth);
//Get the element list for the cell contents
- LinkedList elems = primary.getCellLM().getNextKnuthElements(
+ List elems = primary.getCellLM().getNextKnuthElements(
childLC, alignment);
ElementListObserver.observe(elems, "table-cell", primary.getCell().getId());
primary.setElements(elems);
@@ -124,7 +124,7 @@ class RowGroupLayoutManager {
}
}
computeRowHeights();
- LinkedList elements = tableStepper.getCombinedKnuthElementsForRowGroup(context,
+ List elements = tableStepper.getCombinedKnuthElementsForRowGroup(context,
rowGroup, bodyType);
returnList.addAll(elements);
}
diff --git a/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java b/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java
index 6afb57dca..1b402095d 100644
--- a/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java
@@ -20,13 +20,14 @@
package org.apache.fop.layoutmgr.table;
import java.util.LinkedList;
+import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
import org.apache.fop.area.Area;
import org.apache.fop.area.Block;
import org.apache.fop.area.Trait;
+import org.apache.fop.fo.flow.ListItem;
import org.apache.fop.fo.flow.table.ConditionalBorder;
import org.apache.fop.fo.flow.table.GridUnit;
import org.apache.fop.fo.flow.table.PrimaryGridUnit;
@@ -126,16 +127,16 @@ public class TableCellLayoutManager extends BlockStackingLayoutManager
/**
* {@inheritDoc}
*/
- public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
+ public List getNextKnuthElements(LayoutContext context, int alignment) {
MinOptMax stackLimit = new MinOptMax(context.getStackLimitBP());
referenceIPD = context.getRefIPD();
cellIPD = referenceIPD;
cellIPD -= getIPIndents();
- LinkedList returnedList;
- LinkedList contentList = new LinkedList();
- LinkedList returnList = new LinkedList();
+ List returnedList;
+ List contentList = new LinkedList();
+ List returnList = new LinkedList();
BlockLevelLayoutManager curLM; // currently active LM
BlockLevelLayoutManager prevLM = null; // previously active LM
@@ -187,13 +188,15 @@ public class TableCellLayoutManager extends BlockStackingLayoutManager
}
//Space resolution
SpaceResolver.resolveElementList(returnList);
- if (((KnuthElement) returnList.getFirst()).isForcedBreak()) {
- primaryGridUnit.setBreakBefore(((KnuthPenalty) returnList.getFirst()).getBreakClass());
- returnList.removeFirst();
+ if (((KnuthElement) returnList.get(0)).isForcedBreak()) {
+ primaryGridUnit.setBreakBefore(((KnuthPenalty) returnList.get(0)).getBreakClass());
+ returnList.remove(0);
assert !returnList.isEmpty();
}
- if (((KnuthElement) returnList.getLast()).isForcedBreak()) {
- KnuthPenalty p = (KnuthPenalty) returnList.getLast();
+ final KnuthElement lastItem = (KnuthElement) returnList
+ .get(returnList.size() - 1);
+ if (((KnuthElement) lastItem).isForcedBreak()) {
+ KnuthPenalty p = (KnuthPenalty) lastItem;
primaryGridUnit.setBreakAfter(p.getBreakClass());
p.setP(0);
}
diff --git a/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java b/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
index 0fe47d7b4..d370dc37f 100644
--- a/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
@@ -178,9 +178,9 @@ public class TableLayoutManager extends BlockStackingLayoutManager
}
/** {@inheritDoc} */
- public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
+ public List getNextKnuthElements(LayoutContext context, int alignment) {
- LinkedList returnList = new LinkedList();
+ List returnList = new LinkedList();
/*
* Compute the IPD and adjust it if necessary (overconstrained)
@@ -271,8 +271,8 @@ public class TableLayoutManager extends BlockStackingLayoutManager
int breakBefore = BreakUtil.compareBreakClasses(getTable().getBreakBefore(),
childLC.getBreakBefore());
if (breakBefore != Constants.EN_AUTO) {
- returnList.addFirst(new BreakElement(getAuxiliaryPosition(),
- 0, -KnuthElement.INFINITE, breakBefore, context));
+ returnList.add(0, new BreakElement(getAuxiliaryPosition(), 0,
+ -KnuthElement.INFINITE, breakBefore, context));
}
//addKnuthElementsForBreakAfter(returnList, context);