Skip to content

Commit

Permalink
Add generics to layout
Browse files Browse the repository at this point in the history
  • Loading branch information
simonsteiner1984 committed Jun 26, 2024
1 parent 3d750f3 commit a90458e
Show file tree
Hide file tree
Showing 14 changed files with 33 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public int getContentAreaBPD() {

/** {@inheritDoc} */
@Override
public List getNextKnuthElements(LayoutContext context, int alignment) {
public List<ListElement> getNextKnuthElements(LayoutContext context, int alignment) {
return getNextKnuthElements(context, alignment, null, null, null);
}

Expand All @@ -203,7 +203,7 @@ protected LayoutContext makeChildLayoutContext(LayoutContext context) {

/** {@inheritDoc} */
@Override
public List getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack,
public List<ListElement> getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack,
Position restartPosition, LayoutManager restartAtLM) {

resetSpaces();
Expand Down Expand Up @@ -659,7 +659,7 @@ protected LayoutContext createLayoutContext() {
return lc;
}

protected List getNextKnuthElements(LayoutContext context, int alignment) {
protected List<ListElement> getNextKnuthElements(LayoutContext context, int alignment) {
LayoutManager curLM; // currently active LM
List<ListElement> returnList = new LinkedList<ListElement>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ protected CommonBorderPaddingBackground getCommonBorderPaddingBackground() {

/** {@inheritDoc} */
@Override
public List getNextKnuthElements(LayoutContext context, int alignment) {
public List<ListElement> getNextKnuthElements(LayoutContext context, int alignment) {
return getNextKnuthElements(context, alignment, null, null, null);
}

/** {@inheritDoc} */
@Override
public List getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack,
public List<ListElement> getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack,
Position restartPosition, LayoutManager restartAtLM) {
resetSpaces();
return super.getNextKnuthElements(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,13 @@ protected int updateContentAreaIPDwithOverconstrainedAdjust(int contentIPD) {

/** {@inheritDoc} */
@Override
public List getNextKnuthElements(LayoutContext context, int alignment) {
public List<ListElement> getNextKnuthElements(LayoutContext context, int alignment) {
return getNextKnuthElements(context, alignment, null, null, null);
}

/** {@inheritDoc} */
@Override
public List getNextKnuthElements(LayoutContext context, int alignment,
public List<ListElement> getNextKnuthElements(LayoutContext context, int alignment,
Stack lmStack, Position restartPosition, LayoutManager restartAtLM) {
isRestartAtLM = restartAtLM != null;
referenceIPD = context.getRefIPD();
Expand Down Expand Up @@ -669,12 +669,12 @@ public void discardSpace(KnuthGlue spaceGlue) {

/** {@inheritDoc} */
@Override
public List getChangedKnuthElements(List oldList, int alignment) {
public List<ListElement> getChangedKnuthElements(List oldList, int alignment) {
ListIterator<KnuthElement> oldListIterator = oldList.listIterator();
KnuthElement currElement = null;
KnuthElement prevElement = null;
List<KnuthElement> returnedList = new LinkedList<KnuthElement>();
List<KnuthElement> returnList = new LinkedList<KnuthElement>();
List<ListElement> returnList = new LinkedList<>();
int fromIndex = 0;

// "unwrap" the Positions stored in the elements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public FlowLayoutManager(PageSequenceLayoutManager pslm, Flow node) {

/** {@inheritDoc} */
@Override
public List getNextKnuthElements(LayoutContext context, int alignment) {
public List<ListElement> getNextKnuthElements(LayoutContext context, int alignment) {
return getNextKnuthElements(context, alignment, null, null);
}

Expand All @@ -79,7 +79,7 @@ public List getNextKnuthElements(LayoutContext context, int alignment) {
* @return the list of KnuthElements
* @see LayoutManager#getNextKnuthElements(LayoutContext,int)
*/
List getNextKnuthElements(LayoutContext context, int alignment,
List<ListElement> getNextKnuthElements(LayoutContext context, int alignment,
Position restartPosition, LayoutManager restartLM) {

List<ListElement> elements = new LinkedList<ListElement>();
Expand Down Expand Up @@ -289,11 +289,11 @@ public Keep getKeepWithPrevious() {

/** {@inheritDoc} */
@Override
public List<KnuthElement> getChangedKnuthElements(List oldList, int alignment) {
public List<ListElement> getChangedKnuthElements(List oldList, int alignment) {
ListIterator<KnuthElement> oldListIterator = oldList.listIterator();
KnuthElement returnedElement;
List<KnuthElement> returnedList = new LinkedList<KnuthElement>();
List<KnuthElement> returnList = new LinkedList<KnuthElement>();
List<ListElement> returnList = new LinkedList<>();
KnuthElement prevElement = null;
KnuthElement currElement = null;
int fromIndex = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.apache.fop.layoutmgr.KnuthSequence;
import org.apache.fop.layoutmgr.LayoutContext;
import org.apache.fop.layoutmgr.LeafPosition;
import org.apache.fop.layoutmgr.ListElement;
import org.apache.fop.layoutmgr.Position;
import org.apache.fop.layoutmgr.TraitSetter;
import org.apache.fop.traits.MinOptMax;
Expand Down Expand Up @@ -188,12 +189,12 @@ public boolean applyChanges(List oldList) {

/** {@inheritDoc} */
@Override
public List getChangedKnuthElements(List oldList, int alignment) {
public List<ListElement> getChangedKnuthElements(List<ListElement> oldList, int alignment) {
if (isFinished()) {
return null;
}

LinkedList<KnuthElement> returnList = new LinkedList<KnuthElement>();
LinkedList<ListElement> returnList = new LinkedList<>();

addKnuthElementsForBorderPaddingStart(returnList);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public void addChildLMs(List newLMs) {
}

/** {@inheritDoc} */
public List getNextKnuthElements(LayoutContext context, int alignment) {
public List<ListElement> getNextKnuthElements(LayoutContext context, int alignment) {
List contentList = new LinkedList();
List returnedList;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void initialize() {

/** {@inheritDoc} */
@Override
public List getNextKnuthElements(LayoutContext context,
public List<KnuthSequence> 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
Expand Down Expand Up @@ -125,7 +125,7 @@ public List getNextKnuthElements(LayoutContext context,

/** {@inheritDoc} */
@Override
public List getChangedKnuthElements(List oldList, int alignment, int depth) {
public List<ListElement> getChangedKnuthElements(List<ListElement> oldList, int alignment, int depth) {
List returnedList = super.getChangedKnuthElements(oldList, alignment, depth);
addAnchor(returnedList);
return returnedList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import org.apache.fop.layoutmgr.KnuthSequence;
import org.apache.fop.layoutmgr.LayoutContext;
import org.apache.fop.layoutmgr.LayoutManager;
import org.apache.fop.layoutmgr.ListElement;
import org.apache.fop.layoutmgr.NonLeafPosition;
import org.apache.fop.layoutmgr.Position;
import org.apache.fop.layoutmgr.PositionIterator;
Expand Down Expand Up @@ -566,7 +567,7 @@ public void addChildArea(Area childArea) {

/** {@inheritDoc} */
@Override
public List getChangedKnuthElements(List oldList, int alignment, int depth) {
public List<ListElement> getChangedKnuthElements(List<ListElement> oldList, int alignment, int depth) {
List returnedList = new LinkedList();
addKnuthElementsForBorderPaddingStart(returnedList);
returnedList.addAll(super.getChangedKnuthElements(oldList, alignment, depth));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ public List<ListElement> getNextKnuthElements(LayoutContext context, int alignme
* @return the list of KnuthElements
* @see LayoutManager#getNextKnuthElements(LayoutContext,int)
*/
public List getNextKnuthElements(LayoutContext context, int alignment,
public List<ListElement> getNextKnuthElements(LayoutContext context, int alignment,
LeafPosition restartPosition) {
int parIndex = 0;
int restartPositionIdx = 0;
Expand Down Expand Up @@ -1220,14 +1220,14 @@ public void discardSpace(KnuthGlue spaceGlue) {

/** {@inheritDoc} */
@Override
public List getChangedKnuthElements(List oldList, int alignment, int depth) {
public List<ListElement> getChangedKnuthElements(List<ListElement> oldList, int alignment, int depth) {
return getChangedKnuthElements(oldList, alignment);
}

/** {@inheritDoc} */
@Override
public List getChangedKnuthElements(List oldList, int alignment) {
List<KnuthElement> returnList = new LinkedList<KnuthElement>();
public List<ListElement> getChangedKnuthElements(List<ListElement> oldList, int alignment) {
List<ListElement> returnList = new LinkedList<>();
for (int p = 0; p < knuthParagraphs.size(); p++) {
LineLayoutPossibilities llPoss = lineLayoutsList[p];
//log.debug("demerits of the chosen layout: " + llPoss.getChosenDemerits());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ private GlyphMapping getGlyphMapping(int index) {
}

/** {@inheritDoc} */
public List getNextKnuthElements(final LayoutContext context, final int alignment) {
public List<KnuthSequence> getNextKnuthElements(final LayoutContext context, final int alignment) {

lineStartBAP = context.getLineStartBorderAndPaddingWidth();
lineEndBAP = context.getLineEndBorderAndPaddingWidth();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.apache.fop.layoutmgr.ElementListUtils;
import org.apache.fop.layoutmgr.LayoutContext;
import org.apache.fop.layoutmgr.LayoutManager;
import org.apache.fop.layoutmgr.ListElement;
import org.apache.fop.layoutmgr.NonLeafPosition;
import org.apache.fop.layoutmgr.Position;
import org.apache.fop.layoutmgr.PositionIterator;
Expand Down Expand Up @@ -96,8 +97,8 @@ private void resetSpaces() {
}

/** {@inheritDoc} */
public List getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack,
Position restartPosition, LayoutManager restartAtLM) {
public List<ListElement> getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack,
Position restartPosition, LayoutManager restartAtLM) {
resetSpaces();
List returnList;
returnList = super.getNextKnuthElements(context, alignment, lmStack, restartPosition, restartAtLM);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public Keep getKeepWithPrevious() {
}

/** {@inheritDoc} */
public List getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack,
public List<ListElement> getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack,
Position restartPosition, LayoutManager restartAtLM) {
List<ListElement> elements = new LinkedList<ListElement>();
do {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ private void resetSpaces() {
}

/** {@inheritDoc} */
public List getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack,
public List<ListElement> getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack,
Position restartPosition, LayoutManager restartAtLM) {
referenceIPD = context.getRefIPD();
LayoutContext childLC;
Expand Down Expand Up @@ -614,7 +614,7 @@ private int getMaxRemainingHeight(int[] fullHeights, int[] partialHeights) {

/** {@inheritDoc} */
@Override
public List getChangedKnuthElements(List oldList, int alignment) {
public List<ListElement> getChangedKnuthElements(List oldList, int alignment) {
// label
labelList = label.getChangedKnuthElements(labelList, alignment);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ protected LinkedList getFooterElements() {
* @return the list of KnuthElements
* @see org.apache.fop.layoutmgr.LayoutManager#getNextKnuthElements(LayoutContext, int)
*/
public List getNextKnuthElements(LayoutContext context, int alignment) {
public List<ListElement> getNextKnuthElements(LayoutContext context, int alignment) {
if (LOG.isDebugEnabled()) {
LOG.debug("==> Columns: " + getTableLM().getColumns());
}
Expand Down

0 comments on commit a90458e

Please sign in to comment.