protected LayoutManager originalRestartAtLM;
protected Position positionAtBreak;
- protected List firstElementsForRestart;
+ protected List<ListElement> firstElementsForRestart;
protected PageSequenceLayoutManager pslm;
/**
* @param isFirst true if this is the first time a layout manager instance needs to generate
* border and padding
*/
- protected void addKnuthElementsForBorderPaddingBefore(List returnList, boolean isFirst) {
+ protected void addKnuthElementsForBorderPaddingBefore(List<ListElement> returnList, boolean isFirst) {
//Border and Padding (before)
CommonBorderPaddingBackground borderAndPadding = getBorderPaddingBackground();
if (borderAndPadding != null) {
* @param isLast true if this is the last time a layout manager instance needs to generate
* border and padding
*/
- protected void addKnuthElementsForBorderPaddingAfter(List returnList, boolean isLast) {
+ protected void addKnuthElementsForBorderPaddingAfter(List<ListElement> returnList, boolean isLast) {
//Border and Padding (after)
CommonBorderPaddingBackground borderAndPadding = getBorderPaddingBackground();
if (borderAndPadding != null) {
* @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(List elements, MinOptMax constraint) {
+ public static boolean removeLegalBreaks(List<ListElement> elements, MinOptMax constraint) {
return removeLegalBreaks(elements, constraint.getOpt());
}
* @param end element at which to stop
* @return the content length
*/
- public static int calcContentLength(List elems, int start, int end) {
+ public static int calcContentLength(List<ListElement> elems, int start, int end) {
ListIterator iter = elems.listIterator(start);
int count = end - start + 1;
int len = 0;
* @param elems the element list
* @return true if the list ends with a forced break
*/
- public static boolean endsWithForcedBreak(List elems) {
+ public static boolean endsWithForcedBreak(List<ListElement> elems) {
ListElement last = ListUtil.getLastListElement(elems);
return last == null || last.isForcedBreak();
}
* @param elems the element list
* @return true if the list starts with a forced break
*/
- public static boolean startsWithForcedBreak(List elems) {
- return !elems.isEmpty() && ((ListElement) elems.get(0)).isForcedBreak();
+ public static boolean startsWithForcedBreak(List<ListElement> elems) {
+ return !elems.isEmpty() && elems.get(0).isForcedBreak();
}
/**
* @param elems the element list
* @return true if the list ends with a non-infinite penalty
*/
- public static boolean endsWithNonInfinitePenalty(List elems) {
- ListElement last = (ListElement) ListUtil.getLast(elems);
+ public static boolean endsWithNonInfinitePenalty(List<ListElement> elems) {
+ ListElement last = ListUtil.getLast(elems);
if (last.isPenalty() && ((KnuthPenalty)last).getPenalty() < KnuthElement.INFINITE) {
return true;
} else if (last instanceof BreakElement
* @param startIndex the start index
* @return the position of the previous break, or -1 if there was no previous break
*/
- public static int determinePreviousBreak(List elems, int startIndex) {
+ public static int determinePreviousBreak(List<ListElement> elems, int startIndex) {
int prevBreak = startIndex - 1;
while (prevBreak >= 0) {
KnuthElement el = (KnuthElement)elems.get(prevBreak);
return;
}
removeLast();
- LinkedList oldList = new LinkedList();
+ LinkedList<ListElement> oldList = new LinkedList<>();
// if there are two consecutive KnuthBoxes the
// first one does not represent a whole word,
// so it must be given one more letter space
/**
* @return the list of child LMs
*/
- List getChildLMs();
+ List<LayoutManager> getChildLMs();
/**
* Add the LM in the argument to the list of child LMs;
* Add the LMs in the argument to the list of child LMs;
* @param newLMs the list of LMs to be added
*/
- void addChildLMs(List newLMs);
+ void addChildLMs(List<LayoutManager> newLMs);
/**
* Get a sequence of KnuthElements representing the content
/** {@inheritDoc} */
protected int getNextBlockList(LayoutContext childLC, int nextSequenceStartsOn,
- Position positionAtIPDChange, LayoutManager restartLM, List firstElements) {
+ Position positionAtIPDChange, LayoutManager restartLM, List<ListElement> firstElements) {
if (!layoutRedone && !handlingFloat()) {
if (!firstPart) {
// if this is the first page that will be created by
restartLM, firstElements);
}
- private boolean containsFootnotes(List contentList, LayoutContext context) {
+ private boolean containsFootnotes(List<ListElement> contentList, LayoutContext context) {
boolean containsFootnotes = false;
if (contentList != null) {
for (Object aContentList : contentList) {
/**
* {@inheritDoc}
*/
- public List getChildLMs() {
+ public List<LayoutManager> getChildLMs() {
List childLMs = new ArrayList(1);
childLMs.add(childLM);
return childLMs;
/**
* {@inheritDoc}
*/
- public void addChildLMs(List newLMs) {
+ public void addChildLMs(List<LayoutManager> newLMs) {
if (newLMs == null || newLMs.size() == 0) {
return;
}
return true;
}
- public List addALetterSpaceTo(List oldList) {
+ public List<ListElement> addALetterSpaceTo(List<ListElement> oldList) {
return oldList;
}
- public List addALetterSpaceTo(List oldList, int depth) {
+ public List<ListElement> addALetterSpaceTo(List<ListElement> oldList, int depth) {
return oldList;
}
public void hyphenate(Position pos, HyphContext hyphContext) {
}
- public boolean applyChanges(List oldList) {
+ public boolean applyChanges(List<ListElement> oldList) {
return false;
}
- public boolean applyChanges(List oldList, int depth) {
+ public boolean applyChanges(List<ListElement> oldList, int depth) {
return false;
}
* Creates Knuth elements for start border padding and adds them to the return list.
* @param returnList return list to add the additional elements to
*/
- protected void addKnuthElementsForBorderPaddingStart(List returnList) {
+ protected void addKnuthElementsForBorderPaddingStart(List<ListElement> returnList) {
//Border and Padding (start)
/*
* If the returnlist is a BlockKnuthSequence, the border and padding should be added
* Creates Knuth elements for end border padding and adds them to the return list.
* @param returnList return list to add the additional elements to
*/
- protected void addKnuthElementsForBorderPaddingEnd(List returnList) {
+ protected void addKnuthElementsForBorderPaddingEnd(List<ListElement> returnList) {
//Border and Padding (after)
/*
* If the returnlist is a BlockKnuthSequence, the border and padding should be added
* @param oldList the elements which must be given one more letter space
* @return the new elements replacing the old ones
*/
- List addALetterSpaceTo(List oldList);
+ List<ListElement> addALetterSpaceTo(List<ListElement> oldList);
/**
* Tell the LM to modify its data, adding a letter space
* @param depth the depth at which the Positions for this LM in oldList are found
* @return the new elements replacing the old ones
*/
-List addALetterSpaceTo(List oldList, int depth);
+ List<ListElement> addALetterSpaceTo(List<ListElement> oldList, int depth);
/**
* Get the word chars corresponding to the given position.
* @param oldList the list of the old elements the changes refer to
* @return true if the LM had to change its data, false otherwise
*/
- boolean applyChanges(List oldList);
+ boolean applyChanges(List<ListElement> oldList);
/**
* Tell the LM to apply the changes due to hyphenation
* @param depth the depth at which the Positions for this LM in oldList are found
* @return true if the LM had to change its data, false otherwise
*/
- boolean applyChanges(List oldList, int depth);
+ boolean applyChanges(List<ListElement> oldList, int depth);
/**
* Get a sequence of KnuthElements representing the content
}
/** {@inheritDoc} */
- public List addALetterSpaceTo(List oldList) {
+ public List<ListElement> addALetterSpaceTo(List<ListElement> oldList) {
return addALetterSpaceTo(oldList, 0);
}
/** {@inheritDoc} */
- public List addALetterSpaceTo(List oldList, int thisDepth) {
+ public List<ListElement> addALetterSpaceTo(List<ListElement> oldList, int thisDepth) {
// old list contains only a box, or the sequence: box penalty glue box
ListIterator oldListIterator = oldList.listIterator(oldList.size());
}
/** {@inheritDoc} */
- public boolean applyChanges(List oldList) {
+ public boolean applyChanges(List<ListElement> oldList) {
return applyChanges(oldList, 0);
}
/** {@inheritDoc} */
- public boolean applyChanges(List oldList, int depth) {
+ public boolean applyChanges(List<ListElement> oldList, int depth) {
ListIterator oldListIterator = oldList.listIterator();
KnuthElement oldElement;
depth += 1;
KnuthElement returnedElement;
LinkedList returnedList = new LinkedList();
- LinkedList returnList = new LinkedList();
+ LinkedList<ListElement> returnList = new LinkedList<>();
InlineLevelLayoutManager prevLM = null;
InlineLevelLayoutManager currLM;
int fromIndex = 0;
private Leader fobj;
private Font font;
- private List contentList;
+ private List<ListElement> contentList;
private ContentLayoutManager clm;
private int contentAreaIPD;
}
/** {@inheritDoc} */
- public boolean applyChanges(List oldList) {
+ public boolean applyChanges(List<ListElement> oldList) {
setFinished(false);
return false;
}
return null;
}
- List returnList = new LinkedList();
+ List<ListElement> returnList = new LinkedList<>();
addKnuthElementsForBorderPaddingStart(returnList);
}
/** {@inheritDoc} */
- public List addALetterSpaceTo(List oldList) {
+ public List<ListElement> addALetterSpaceTo(List<ListElement> oldList) {
// return the unchanged elements
return oldList;
}
* {@inheritDoc}
* Only TextLM has a meaningful implementation of this method
*/
- public List addALetterSpaceTo(List oldList, int depth) {
+ public List<ListElement> addALetterSpaceTo(List<ListElement> oldList, int depth) {
return addALetterSpaceTo(oldList);
}
}
/** {@inheritDoc} */
- public boolean applyChanges(List oldList) {
+ public boolean applyChanges(List<ListElement> oldList) {
setFinished(false);
return false;
}
* {@inheritDoc}
* Only TextLM has a meaningful implementation of this method
*/
- public boolean applyChanges(List oldList, int depth) {
+ public boolean applyChanges(List<ListElement> oldList, int depth) {
return applyChanges(oldList);
}
* Creates Knuth elements for start border padding and adds them to the return list.
* @param returnList return list to add the additional elements to
*/
- protected void addKnuthElementsForBorderPaddingStart(List returnList) {
+ protected void addKnuthElementsForBorderPaddingStart(List<ListElement> returnList) {
//Border and Padding (start)
if (commonBorderPaddingBackground != null) {
int ipStart = commonBorderPaddingBackground.getBorderStartWidth(false)
* Creates Knuth elements for end border padding and adds them to the return list.
* @param returnList return list to add the additional elements to
*/
- protected void addKnuthElementsForBorderPaddingEnd(List returnList) {
+ protected void addKnuthElementsForBorderPaddingEnd(List<ListElement> returnList) {
//Border and Padding (after)
if (commonBorderPaddingBackground != null) {
int ipEnd = commonBorderPaddingBackground.getBorderEndWidth(false)
}
/** {@inheritDoc} */
- public List addALetterSpaceTo(List oldList) {
+ public List<ListElement> addALetterSpaceTo(List<ListElement> oldList) {
return addALetterSpaceTo(oldList, 0);
}
/** {@inheritDoc} */
- public List addALetterSpaceTo(final List oldList, int depth) {
+ public List<ListElement> addALetterSpaceTo(final List<ListElement> oldList, int depth) {
// old list contains only a box, or the sequence: box penalty glue box;
// look at the Position stored in the first element in oldList
// which is always a box
}
/** {@inheritDoc} */
- public boolean applyChanges(final List oldList) {
+ public boolean applyChanges(final List<ListElement> oldList) {
return applyChanges(oldList, 0);
}
/** {@inheritDoc} */
- public boolean applyChanges(final List oldList, int depth) {
+ public boolean applyChanges(final List<ListElement> oldList, int depth) {
// make sure the LM appears unfinished in between this call
// and the next call to getChangedKnuthElements()
return null;
}
- final LinkedList returnList = new LinkedList();
+ final LinkedList<ListElement> returnList = new LinkedList<>();
for (; returnedIndices[0] <= returnedIndices[1]; returnedIndices[0]++) {
GlyphMapping mapping = getGlyphMapping(returnedIndices[0]);
return retval;
}
- private boolean shouldWeAvoidBreak(List returnList, LayoutManager lm) {
+ private boolean shouldWeAvoidBreak(List<ListElement> returnList, LayoutManager lm) {
if (isChangingIPD(lm)) {
if (lm instanceof BlockLayoutManager) {
return true;
cellIPD -= getIPIndents();
List returnedList;
- List contentList = new LinkedList();
+ List<ListElement> contentList = new LinkedList<>();
List<ListElement> returnList = new LinkedList<>();
LayoutManager curLM; // currently active LM
*/
private LinkedList getKnuthElementsForRowIterator(TableRowIterator iter,
LayoutContext context, int alignment, int bodyType) {
- LinkedList returnList = new LinkedList();
+ LinkedList<ListElement> returnList = new LinkedList<>();
EffRow[] rowGroup = iter.getNextRowGroup();
// TODO homogenize the handling of keeps and breaks
context.clearKeepsPending();
import org.apache.fop.layoutmgr.KnuthPenalty;
import org.apache.fop.layoutmgr.LayoutContext;
import org.apache.fop.layoutmgr.LayoutManager;
+import org.apache.fop.layoutmgr.ListElement;
import org.apache.fop.layoutmgr.Position;
import org.apache.fop.util.BreakUtil;
int cumulateLength = 0; // Length of the content accumulated before the break
TableContentPosition lastTCPos = null;
- LinkedList returnList = new LinkedList();
+ LinkedList<ListElement> returnList = new LinkedList<>();
int laststep = 0;
int step = getFirstStep();
do {