You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Adrian Cumiskey <ad...@gmail.com> on 2008/06/09 16:25:29 UTC

Re: svn commit: r665699 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop: fo/flow/table/ layoutmgr/ layoutmgr/inline/ layoutmgr/list/ layoutmgr/table/

This is really good Max, really appreciate what you are trying to do here.  It must have been quite 
boring and laborious...  but great cleanup work :).

maxberger@apache.org wrote:
> Author: maxberger
> Date: Mon Jun  9 07:15:38 2008
> New Revision: 665699
> 
> URL: http://svn.apache.org/viewvc?rev=665699&view=rev
> Log:
> Replaced LinkedList with generic List interface
> 
> Modified:
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/ElementListUtils.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthBlockBox.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LayoutManager.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreaker.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/SpaceResolver.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/RowGroupLayoutManager.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
> 
> Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java
> URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java?rev=665699&r1=665698&r2=665699&view=diff
> ==============================================================================
> --- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java (original)
> +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java Mon Jun  9 07:15:38 2008
> @@ -38,7 +38,7 @@
>      /** 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 @@
>       *
>       * @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;
>      }
>  
> 
> Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
> URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java?rev=665699&r1=665698&r2=665699&view=diff
> ==============================================================================
> --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java (original)
> +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java Mon Jun  9 07:15:38 2008
> @@ -211,7 +211,7 @@
>       * 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 @@
>          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 @@
>              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:
> 
> Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
> URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java?rev=665699&r1=665698&r2=665699&view=diff
> ==============================================================================
> --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java (original)
> +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java Mon Jun  9 07:15:38 2008
> @@ -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 @@
>      }
>  
>      /** {@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 @@
>      }
>  
>      /** {@inheritDoc} */
> -    public LinkedList getChangedKnuthElements(List oldList,
> +    public List getChangedKnuthElements(List oldList,
>                                                int alignment) {
>          log.warn("null implementation of getChangeKnuthElement() called!");
>          return null;
> 
> Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
> URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java?rev=665699&r1=665698&r2=665699&view=diff
> ==============================================================================
> --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java (original)
> +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java Mon Jun  9 07:15:38 2008
> @@ -189,7 +189,7 @@
>      }
>      
>      /** {@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 @@
>          
>          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 @@
>                      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 @@
>                          //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 @@
>          return returnList;
>      }
>      
> -    private LinkedList getNextKnuthElementsAbsolute(LayoutContext context, int alignment) {
> +    private List getNextKnuthElementsAbsolute(LayoutContext context, int alignment) {
>          autoHeight = false;
>  
>          boolean switchedProgressionDirection
> @@ -515,7 +516,7 @@
>              }
>              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 @@
>              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 @@
>                  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 @@
>  
>          // "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 @@
>                  //    // 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);
> 
> Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
> URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java?rev=665699&r1=665698&r2=665699&view=diff
> ==============================================================================
> --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java (original)
> +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java Mon Jun  9 07:15:38 2008
> @@ -113,7 +113,7 @@
>      }
>  
>      /** {@inheritDoc} */
> -    public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
> +    public List getNextKnuthElements(LayoutContext context, int alignment) {
>          resetSpaces(); 
>          return super.getNextKnuthElements(context, alignment);
>      }
> 
> Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
> URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java?rev=665699&r1=665698&r2=665699&view=diff
> ==============================================================================
> --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java (original)
> +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java Mon Jun  9 07:15:38 2008
> @@ -63,7 +63,7 @@
>      /** 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 @@
>      }
>      
>      /** {@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 @@
>          
>          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 @@
>              }
>              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 @@
>                      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 @@
>       * @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 @@
>              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 @@
>      /**
>       * {@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 @@
>          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 @@
>                      // 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 @@
>                  // 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 @@
>       * @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 @@
>       * @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 @@
>       * @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 @@
>       * @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 @@
>       * @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 @@
>       * @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 @@
>          }*/
>      }
>  
> -    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 @@
>          // 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
> 
> Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/ElementListUtils.java
> URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/ElementListUtils.java?rev=665699&r1=665698&r2=665699&view=diff
> ==============================================================================
> --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/ElementListUtils.java (original)
> +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/ElementListUtils.java Mon Jun  9 07:15:38 2008
> @@ -38,7 +38,7 @@
>       * @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 @@
>       * @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 @@
>       * @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 @@
>       * @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 @@
>       * @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
> 
> Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
> URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java?rev=665699&r1=665698&r2=665699&view=diff
> ==============================================================================
> --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java (original)
> +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java Mon Jun  9 07:15:38 2008
> @@ -64,7 +64,7 @@
>      }
>  
>      /** {@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 @@
>  
>          // 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 @@
>              }
>  
>              // "wrap" the Position inside each element
> -            LinkedList tempList = returnedList;
> +            List tempList = returnedList;
>              returnedList = new LinkedList();
>              wrapPositionElements(tempList, returnedList);
>  
> @@ -213,11 +213,11 @@
>      }
>      
>      /** {@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 @@
>                      // 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));
>                  }
> 
> Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthBlockBox.java
> URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthBlockBox.java?rev=665699&r1=665698&r2=665699&view=diff
> ==============================================================================
> --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthBlockBox.java (original)
> +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/KnuthBlockBox.java Mon Jun  9 07:15:38 2008
> @@ -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 @@
>       * 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 @@
>       * @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 @@
>      /**
>       * @return the LMs for the footnotes cited in this box.
>       */
> -    public LinkedList getFootnoteBodyLMs() {
> +    public List getFootnoteBodyLMs() {
>          return footnoteList;
>      }
>  
> @@ -86,7 +87,7 @@
>       * 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 @@
>       * @return a list of KnuthElement sequences corresponding to footnotes cited in this
>       * box
>       */
> -    public LinkedList getElementLists() {
> +    public List getElementLists() {
>          return elementLists;
>      }
>  
> 
> Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LayoutManager.java
> URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LayoutManager.java?rev=665699&r1=665698&r2=665699&view=diff
> ==============================================================================
> --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LayoutManager.java (original)
> +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LayoutManager.java Mon Jun  9 07:15:38 2008
> @@ -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 @@
>       * @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 @@
>       * @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
> 
> Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreaker.java
> URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreaker.java?rev=665699&r1=665698&r2=665699&view=diff
> ==============================================================================
> --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreaker.java (original)
> +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreaker.java Mon Jun  9 07:15:38 2008
> @@ -135,8 +135,8 @@
>      }
>      
>      /** {@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 @@
>                      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
> 
> Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
> URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java?rev=665699&r1=665698&r2=665699&view=diff
> ==============================================================================
> --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java (original)
> +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java Mon Jun  9 07:15:38 2008
> @@ -21,11 +21,11 @@
>  
>  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 @@
>       * @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 @@
>          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);
> 
> Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/SpaceResolver.java
> URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/SpaceResolver.java?rev=665699&r1=665698&r2=665699&view=diff
> ==============================================================================
> --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/SpaceResolver.java (original)
> +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/SpaceResolver.java Mon Jun  9 07:15:38 2008
> @@ -614,7 +614,7 @@
>       * 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);
>          }
> 
> Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
> URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java?rev=665699&r1=665698&r2=665699&view=diff
> ==============================================================================
> --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java (original)
> +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java Mon Jun  9 07:15:38 2008
> @@ -87,7 +87,7 @@
>      }
>  
>      /** {@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 @@
>          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 @@
>              //    + 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 @@
>              }
>  
>              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 @@
>                          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 @@
>              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 @@
>                  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()) {
> 
> Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java
> URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java?rev=665699&r1=665698&r2=665699&view=diff
> ==============================================================================
> --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java (original)
> +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java Mon Jun  9 07:15:38 2008
> @@ -21,7 +21,7 @@
>  
>  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 @@
>      }
>      
>      /** {@inheritDoc} */
> -    public LinkedList getNextKnuthElements(LayoutContext context,
> +    public List getNextKnuthElements(LayoutContext context,
>                                             int alignment) {
>          Viewport areaCurrent = getInlineArea();
>          setCurrentArea(areaCurrent);
> 
> Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java
> URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java?rev=665699&r1=665698&r2=665699&view=diff
> ==============================================================================
> --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java (original)
> +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java Mon Jun  9 07:15:38 2008
> @@ -90,7 +90,7 @@
>      }
>  
>      /** {@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 @@
>      }
>  
>      /** {@inheritDoc} */
> -    public LinkedList getChangedKnuthElements(List oldList, int alignment) {
> +    public List getChangedKnuthElements(List oldList, int alignment) {
>          if (isFinished()) {
>              return null;
>          }
> 
> Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java
> URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java?rev=665699&r1=665698&r2=665699&view=diff
> ==============================================================================
> --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java (original)
> +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java Mon Jun  9 07:15:38 2008
> @@ -27,8 +27,6 @@
>  
>  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 @@
>  
>          stackSize = 0;
>  
> -        LinkedList contentList =
> +        List contentList =
>              getNextKnuthElements(childLC, Constants.EN_START);
>          ListIterator contentIter = contentList.listIterator();
>          while (contentIter.hasNext()) {
> @@ -254,9 +252,9 @@
>          }
>      }
>  
> -    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 @@
>                  // 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 @@
>          return false;
>      }
>  
> -    public LinkedList getChangedKnuthElements(List oldList,
> +    public List getChangedKnuthElements(List oldList,
>                                                /*int flaggedPenalty,*/
>                                                int alignment) {
>          return null;
> 
> Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java
> URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java?rev=665699&r1=665698&r2=665699&view=diff
> ==============================================================================
> --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java (original)
> +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java Mon Jun  9 07:15:38 2008
> @@ -71,7 +71,7 @@
>      }
>  
>      /** {@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 @@
>          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 @@
>      /**
>       * {@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 @@
>       * 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());
> 
> Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java
> URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java?rev=665699&r1=665698&r2=665699&view=diff
> ==============================================================================
> --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java (original)
> +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java Mon Jun  9 07:15:38 2008
> @@ -233,14 +233,14 @@
>      }
>  
>      /** {@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 @@
>                  context.updateKeepWithNextPending(childLC.getKeepWithNextPending());
>                  childLC.clearKeepsPending();
>              }
> -            lastSequence = (KnuthSequence) returnList.getLast();
> +            lastSequence = (KnuthSequence) returnList
> +                    .get(returnList.size() - 1);
>              lastChildLM = curLM;
>          }
>          
> @@ -432,7 +433,7 @@
>          // 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 @@
>      }
>  
>      /** {@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);
> 
> Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java
> URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java?rev=665699&r1=665698&r2=665699&view=diff
> ==============================================================================
> --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java (original)
> +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineStackingLayoutManager.java Mon Jun  9 07:15:38 2008
> @@ -364,7 +364,7 @@
>      /**
>       * {@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;
> 
> Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java
> URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java?rev=665699&r1=665698&r2=665699&view=diff
> ==============================================================================
> --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java (original)
> +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java Mon Jun  9 07:15:38 2008
> @@ -52,7 +52,7 @@
>      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 @@
>      }
>  
>      /** {@inheritDoc} */
> -    public LinkedList getNextKnuthElements(LayoutContext context,
> +    public List getNextKnuthElements(LayoutContext context,
>                                             int alignment) {
>          MinOptMax ipd;
>          curArea = get(context);
> @@ -305,13 +305,13 @@
>      }
>  
>      /** {@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);
>          
> 
> Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java
> URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java?rev=665699&r1=665698&r2=665699&view=diff
> ==============================================================================
> --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java (original)
> +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java Mon Jun  9 07:15:38 2008
> @@ -249,7 +249,7 @@
>      }
>      
>      /** {@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 @@
>      }
>  
>      /** {@inheritDoc} */
> -    public LinkedList getChangedKnuthElements(List oldList,
> +    public List getChangedKnuthElements(List oldList,
>                                                int alignment) {
>          if (isFinished()) {
>              return null;
> 
> Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
> URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java?rev=665699&r1=665698&r2=665699&view=diff
> ==============================================================================
> --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java (original)
> +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java Mon Jun  9 07:15:38 2008
> @@ -574,7 +574,7 @@
>      }
>  
>      /** {@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 @@
>          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 @@
>              }
>              
>              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 @@
>       * @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 @@
>       * @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 @@
>              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 @@
>                        = ((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 @@
>      /**
>       * {@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 @@
>          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 @@
>                  .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,
> 
> Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
> URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java?rev=665699&r1=665698&r2=665699&view=diff
> ==============================================================================
> --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java (original)
> +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java Mon Jun  9 07:15:38 2008
> @@ -523,12 +523,12 @@
>      }
>      
>      /** {@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 @@
>              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 @@
>          }
>      }
>  
> -    private KnuthSequence processLinebreak(final LinkedList returnList,
> +    private KnuthSequence processLinebreak(final List returnList,
>              KnuthSequence sequence) {
>          if (this.lineEndBAP != 0) {
>              sequence.add(
> @@ -942,7 +942,7 @@
>      }
>  
>      /** {@inheritDoc} */
> -    public LinkedList getChangedKnuthElements(final List oldList,
> +    public List getChangedKnuthElements(final List oldList,
>                                                final int alignment) {
>          if (this.isFinished()) {
>              return null;
> 
> Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java
> URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java?rev=665699&r1=665698&r2=665699&view=diff
> ==============================================================================
> --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java (original)
> +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java Mon Jun  9 07:15:38 2008
> @@ -115,9 +115,9 @@
>      }
>      
>      /** {@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 @@
>      }
>     
>      /** {@inheritDoc} */
> -    public LinkedList getChangedKnuthElements(List oldList, int alignment) {
> +    public List getChangedKnuthElements(List oldList, int alignment) {
>          //log.debug("LBLM.getChangedKnuthElements>");
>          return super.getChangedKnuthElements(oldList, alignment);
>      }
> 
> Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java
> URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java?rev=665699&r1=665698&r2=665699&view=diff
> ==============================================================================
> --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java (original)
> +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java Mon Jun  9 07:15:38 2008
> @@ -98,7 +98,7 @@
>      }
>  
>      /** {@inheritDoc} */
> -    public LinkedList getChangedKnuthElements(List oldList, int alignment) {
> +    public List getChangedKnuthElements(List oldList, int alignment) {
>          //log.debug("  ListItemContentLayoutManager.getChanged>");
>          return super.getChangedKnuthElements(oldList, alignment);
>      }
> 
> Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
> URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java?rev=665699&r1=665698&r2=665699&view=diff
> ==============================================================================
> --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java (original)
> +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java Mon Jun  9 07:15:38 2008
> @@ -72,8 +72,8 @@
>  
>      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 @@
>      }
>      
>      /** {@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 @@
>          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 @@
>          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 @@
>      /**
>       * {@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 @@
>              }
>          }
>  
> -        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();
> 
> Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/RowGroupLayoutManager.java
> URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/RowGroupLayoutManager.java?rev=665699&r1=665698&r2=665699&view=diff
> ==============================================================================
> --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/RowGroupLayoutManager.java (original)
> +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/RowGroupLayoutManager.java Mon Jun  9 07:15:38 2008
> @@ -21,10 +21,10 @@
>  
>  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 @@
>                      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 @@
>              }
>          }
>          computeRowHeights();
> -        LinkedList elements = tableStepper.getCombinedKnuthElementsForRowGroup(context,
> +        List elements = tableStepper.getCombinedKnuthElementsForRowGroup(context,
>                  rowGroup, bodyType);
>          returnList.addAll(elements);
>      }
> 
> Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java
> URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java?rev=665699&r1=665698&r2=665699&view=diff
> ==============================================================================
> --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java (original)
> +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java Mon Jun  9 07:15:38 2008
> @@ -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 @@
>      /**
>       * {@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 @@
>          }
>          //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);
>          }
> 
> Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
> URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java?rev=665699&r1=665698&r2=665699&view=diff
> ==============================================================================
> --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java (original)
> +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java Mon Jun  9 07:15:38 2008
> @@ -178,9 +178,9 @@
>      }
>  
>      /** {@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 @@
>          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);
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org
> 
> 


Re: svn commit: r665699 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop: fo/flow/table/ layoutmgr/ layoutmgr/inline/ layoutmgr/list/ layoutmgr/table/

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
On 09.06.2008 18:46:23 Adrian Cumiskey wrote:
> After looking more closely at this I think I may have been a little hasty in my praise and Jeremias 
> has a point, but Max's sentiment is a right one.

I don't disagree.

> On the subject of readability, there is much cleaning up and refactoring that needs to be done to 
> make the code base more simple and easy to understand.  This is especially the case in the areas of 
> layout (LayoutManager implementers) and rendering.  Below is a list of java classes and their 
> current line count in trunk.
> 
>  > find ./src/java -type f -name \*.java | xargs wc -l $@ | sort -n -r
> 
>     2786 ./src/java/org/apache/fop/fo/FOPropertyMapping.java
>     1890 ./src/java/org/apache/fop/render/afp/AFPRenderer.java
>     1848 ./src/java/org/apache/fop/render/pdf/PDFRenderer.java
>     1829 ./src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
>     1822 ./src/java/org/apache/fop/svg/PDFGraphics2D.java
>     1726 ./src/java/org/apache/fop/render/rtf/RTFHandler.java
>     1724 ./src/java/org/apache/fop/render/ps/PSRenderer.java
>     1666 ./src/java/org/apache/fop/pdf/PDFFactory.java
>     1662 ./src/java/org/apache/fop/render/pcl/PCLRenderer.java
>     1631 ./src/java/org/apache/fop/fonts/truetype/TTFFile.java
>     1597 ./src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
>     1315 ./src/java/org/apache/fop/fonts/Glyphs.java
>     1291 ./src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
>     1173 ./src/java/org/apache/fop/area/AreaTreeParser.java
>     1144 ./src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java
>     1118 ./src/java/org/apache/fop/fo/Constants.java
>     1107 ./src/java/org/apache/fop/cli/CommandLineOptions.java
>     1087 ./src/java/org/apache/fop/pdf/PDFDocument.java
>     1085 ./src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
>     1022 ./src/java/org/apache/fop/render/xml/XMLRenderer.java
>     1017 ./src/java/org/apache/fop/render/java2d/Java2DRenderer.java
>      902 ./src/java/org/apache/fop/render/pcl/PCLGenerator.java
>      892 ./src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
>      892 ./src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
> 
> We currently have Checkstyle set FileLengthCheck to a maximum of 2000 lines.  Of course I realize 
> there is a necessary complexity in the processing task, but IMO a class shouldn't really be more 
> than say 500-600 lines long..  otherwise its just doing too much and should be delegating to another 
> class.  I would be interested to hear your thoughts on this.

There's absolutely nothing to be said against that IMO. But you know:
meager resources means concentration on the most important points. It's
good to be reminded from time to time of these things and it's good to
always keep it in mind while working on the code. Just for those who
aren't here that long: Relatively speaking I'm happier with the current
situation than with pre-redesign times. Today's codebase is much easier
to maintain and enhance already.

<snip/>



Jeremias Maerki


Re: svn commit: r665699 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop: fo/flow/table/ layoutmgr/ layoutmgr/inline/ layoutmgr/list/ layoutmgr/table/

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
On 09.06.2008 17:45:51 Andreas Delmelle wrote:
<snip/>
> It never hurts to check with the other devs  
> before committing. If I find myself in such a situation, I'm inclined  
> to attach the patch to a Bugzilla entry first, and give everyone a  
> chance to comment in on the proposed changes. If no feedback comes in  
> after a few days, you can reasonably assume that the other committers  
> are OK with it.

+1

<snip/> 



Jeremias Maerki


Re: svn commit: r665699 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop: fo/flow/table/ layoutmgr/ layoutmgr/inline/ layoutmgr/list/ layoutmgr/table/

Posted by Andreas Delmelle <an...@telenet.be>.
On Jun 9, 2008, at 18:46, Adrian Cumiskey wrote:

> After looking more closely at this I think I may have been a little  
> hasty in my praise and Jeremias has a point, but Max's sentiment is  
> a right one.
>
> On the subject of readability, there is much cleaning up and  
> refactoring that needs to be done to make the code base more simple  
> and easy to understand.  This is especially the case in the areas  
> of layout (LayoutManager implementers) and rendering.  Below is a  
> list of java classes and their current line count in trunk.
> <snip />
> We currently have Checkstyle set FileLengthCheck to a maximum of  
> 2000 lines.  Of course I realize there is a necessary complexity in  
> the processing task, but IMO a class shouldn't really be more than  
> say 500-600 lines long..  otherwise its just doing too much and  
> should be delegating to another class.  I would be interested to  
> hear your thoughts on this.

As a general rule, I agree that source files should be kept at a  
reasonable line count. For some cases, like FOPropertyMapping, I  
think it is not really necessary or desirable to chop that up in  
separate classes just to respect a Checkstyle rule, though.  
Exceptions to a rule are always possible. One class in over a  
thousand counts as exceptional in my book. (That said, even 25 in a  
thousand is still a rather small portion...)

A different matter for LineLayoutManager, for example. IIRC, in the  
Temp_Interleaved_Page_Line_Breaking branch, Simon has already split  
this class up. I had also started something like that locally.  
LineLayoutManager mainly has some inner classes which can be migrated  
to their own source file to alleviate this.

Something similar probably holds for some of the other classes, but I  
can't say for sure without investigating.



Cheers

Andreas

Re: svn commit: r665699 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop: fo/flow/table/ layoutmgr/ layoutmgr/inline/ layoutmgr/list/ layoutmgr/table/

Posted by Adrian Cumiskey <ad...@gmail.com>.
After looking more closely at this I think I may have been a little hasty in my praise and Jeremias 
has a point, but Max's sentiment is a right one.

On the subject of readability, there is much cleaning up and refactoring that needs to be done to 
make the code base more simple and easy to understand.  This is especially the case in the areas of 
layout (LayoutManager implementers) and rendering.  Below is a list of java classes and their 
current line count in trunk.

 > find ./src/java -type f -name \*.java | xargs wc -l $@ | sort -n -r

    2786 ./src/java/org/apache/fop/fo/FOPropertyMapping.java
    1890 ./src/java/org/apache/fop/render/afp/AFPRenderer.java
    1848 ./src/java/org/apache/fop/render/pdf/PDFRenderer.java
    1829 ./src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
    1822 ./src/java/org/apache/fop/svg/PDFGraphics2D.java
    1726 ./src/java/org/apache/fop/render/rtf/RTFHandler.java
    1724 ./src/java/org/apache/fop/render/ps/PSRenderer.java
    1666 ./src/java/org/apache/fop/pdf/PDFFactory.java
    1662 ./src/java/org/apache/fop/render/pcl/PCLRenderer.java
    1631 ./src/java/org/apache/fop/fonts/truetype/TTFFile.java
    1597 ./src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
    1315 ./src/java/org/apache/fop/fonts/Glyphs.java
    1291 ./src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
    1173 ./src/java/org/apache/fop/area/AreaTreeParser.java
    1144 ./src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java
    1118 ./src/java/org/apache/fop/fo/Constants.java
    1107 ./src/java/org/apache/fop/cli/CommandLineOptions.java
    1087 ./src/java/org/apache/fop/pdf/PDFDocument.java
    1085 ./src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
    1022 ./src/java/org/apache/fop/render/xml/XMLRenderer.java
    1017 ./src/java/org/apache/fop/render/java2d/Java2DRenderer.java
     902 ./src/java/org/apache/fop/render/pcl/PCLGenerator.java
     892 ./src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
     892 ./src/java/org/apache/fop/layoutmgr/AbstractBreaker.java

We currently have Checkstyle set FileLengthCheck to a maximum of 2000 lines.  Of course I realize 
there is a necessary complexity in the processing task, but IMO a class shouldn't really be more 
than say 500-600 lines long..  otherwise its just doing too much and should be delegating to another 
class.  I would be interested to hear your thoughts on this.

Adrian.

Andreas Delmelle wrote:
> On Jun 9, 2008, at 16:40, Jeremias Maerki wrote:
> 
>> Frankly, I'm less than thrilled. I appreciate the good will behind this
>> but I'd have appreciated some advance warning, too. My concern is that:
>> -        ListElement last = (ListElement)contentList.getLast();
>>
>> is much easier to read and write than:
>>
>> +        ListElement last = (ListElement) contentList
>> +                .get(contentList.size() - 1);
>>
>> When working with element lists constructs like the above are everywhere.
>> A linked list IS the most efficient data structure for element lists. I
>> generally support using the generic type instead of the specific class
>> (i.e. List instead of ArrayList), but LinkedList is adding some often
>> used methods for element lists which improve code readability. I'm
>> curious what other committers think about this.
> 
> Unfortunately for Max maybe, but I agree with this assessment.
> 
> In general, I have no objections to switching to the interface where it 
> is applicable/beneficial. As a rule of thumb, I'd reserve this approach 
> for any part/class in FOP that has potential use for external libraries.
> 
> Don't confuse this with simple 'public' visibility: a lot of methods are 
> made public, because they need to be accessible from within other FOP 
> sub-packages, but that does not mean that they are part of the public 
> API. Similarly, some methods may be marked as 'protected', but still 
> they would be visible to subclasses outside of FOP. So, this needs to be 
> determined for every occurrence separately.
> 
> For anything that remains FOP-internal, using concrete implementations 
> does not only improve code-readability and -writability, but IIC, it 
> also generates more efficient byte-code in the end. At run-time, the 
> interpreter would spend slightly less time on determining the actual 
> implementation of a method to be used.
> 
> For the above example, the interpreter originally only needed to check 
> the available implementations of getLast() (defined in the concrete 
> class LinkedList), while after the change, it would need to check those 
> of get() (defined in the List interface). Checking for the 
> implementations of interface methods is known to be slightly more 
> demanding than for class methods.
> Also, if we always know that the concrete type of the List in question 
> is a LinkedList, index-based access is generally taken to be a bad idea.
> list.getLast() is likely to outperform list.get(list.size() - 1), 
> especially if the lists grow large....
> 
> Painful lesson, maybe, but try to be mindful about changes across many 
> classes/packages, especially if they concern more than just 
> documentation or styling. It never hurts to check with the other devs 
> before committing. If I find myself in such a situation, I'm inclined to 
> attach the patch to a Bugzilla entry first, and give everyone a chance 
> to comment in on the proposed changes. If no feedback comes in after a 
> few days, you can reasonably assume that the other committers are OK 
> with it.
> 
> 
> 
> Cheers
> 
> Andreas
> 
> 


Re: svn commit: r665699 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop: fo/flow/table/ layoutmgr/ layoutmgr/inline/ layoutmgr/list/ layoutmgr/table/

Posted by Vincent Hennebert <vi...@anyware-tech.com>.
(I had been writing this before I received Max’s answer. Still...)

>From a general point of vue I agree that declaring a LinkedList makes
sense, when you want to stress the fact that you’re working with
a sequential structure with which it’s cheap to add/remove/access
elements at the beginning or end, but costly to retrieve one particular
element in the middle.
The unfortunate fact in Java is that the getFirst/Last and addFirst/Last
methods are available only in the LinkedList concrete class, and not on
an interface. Starting from Java 1.5 the Queue interface fills this gap
and would probably be used instead.

That said, on this particular topic, one may raise the question whether
the getNextKnuthElements methods should really return a sequential
structure or just a list. Looking at the commit, most of the getLast
method calls are used to test if the last returned element is a forced
break. In some future this should disappear and be handled a different
way (add a break /between/ blocks if there must be one). So I’m ok with
Max’s change.

And, still, congrats Max! It’s not the funniest of the jobs.

Andreas Delmelle wrote:
<snip/>
> For anything that remains FOP-internal, using concrete implementations
> does not only improve code-readability and -writability, but IIC, it
> also generates more efficient byte-code in the end. At run-time, the
> interpreter would spend slightly less time on determining the actual
> implementation of a method to be used.
> 
> For the above example, the interpreter originally only needed to check
> the available implementations of getLast() (defined in the concrete
> class LinkedList), while after the change, it would need to check those
> of get() (defined in the List interface). Checking for the
> implementations of interface methods is known to be slightly more
> demanding than for class methods.
> Also, if we always know that the concrete type of the List in question
> is a LinkedList, index-based access is generally taken to be a bad idea.
> list.getLast() is likely to outperform list.get(list.size() - 1),
> especially if the lists grow large....

I really have to disagree here. In general I would be very reluctant to
sacrifice code encapsulation to optimization, unless the gain in
performance is significant. And on this particular point there’s
absolutely no benefit. The method lookup is negligible and probably done
only once, and there’s also JIT compiling that blurs things. And the
implementation of get in LinkedList is intelligent enough to start from
the end of the list when applicable. See the attached code, that’s worth
what it’s worth, but the same amount of time is spent in both ways.

Vincent


-- 
Vincent Hennebert                            Anyware Technologies
http://people.apache.org/~vhennebert         http://www.anyware-tech.com
Apache FOP Committer                         FOP Development/Consulting

Re: svn commit: r665699 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop: fo/flow/table/ layoutmgr/ layoutmgr/inline/ layoutmgr/list/ layoutmgr/table/

Posted by Andreas Delmelle <an...@telenet.be>.
On Jun 9, 2008, at 16:40, Jeremias Maerki wrote:

> Frankly, I'm less than thrilled. I appreciate the good will behind  
> this
> but I'd have appreciated some advance warning, too. My concern is  
> that:
> -        ListElement last = (ListElement)contentList.getLast();
>
> is much easier to read and write than:
>
> +        ListElement last = (ListElement) contentList
> +                .get(contentList.size() - 1);
>
> When working with element lists constructs like the above are  
> everywhere.
> A linked list IS the most efficient data structure for element  
> lists. I
> generally support using the generic type instead of the specific class
> (i.e. List instead of ArrayList), but LinkedList is adding some often
> used methods for element lists which improve code readability. I'm
> curious what other committers think about this.

Unfortunately for Max maybe, but I agree with this assessment.

In general, I have no objections to switching to the interface where  
it is applicable/beneficial. As a rule of thumb, I'd reserve this  
approach for any part/class in FOP that has potential use for  
external libraries.

Don't confuse this with simple 'public' visibility: a lot of methods  
are made public, because they need to be accessible from within other  
FOP sub-packages, but that does not mean that they are part of the  
public API. Similarly, some methods may be marked as 'protected', but  
still they would be visible to subclasses outside of FOP. So, this  
needs to be determined for every occurrence separately.

For anything that remains FOP-internal, using concrete  
implementations does not only improve code-readability and - 
writability, but IIC, it also generates more efficient byte-code in  
the end. At run-time, the interpreter would spend slightly less time  
on determining the actual implementation of a method to be used.

For the above example, the interpreter originally only needed to  
check the available implementations of getLast() (defined in the  
concrete class LinkedList), while after the change, it would need to  
check those of get() (defined in the List interface). Checking for  
the implementations of interface methods is known to be slightly more  
demanding than for class methods.
Also, if we always know that the concrete type of the List in  
question is a LinkedList, index-based access is generally taken to be  
a bad idea.
list.getLast() is likely to outperform list.get(list.size() - 1),  
especially if the lists grow large....

Painful lesson, maybe, but try to be mindful about changes across  
many classes/packages, especially if they concern more than just  
documentation or styling. It never hurts to check with the other devs  
before committing. If I find myself in such a situation, I'm inclined  
to attach the patch to a Bugzilla entry first, and give everyone a  
chance to comment in on the proposed changes. If no feedback comes in  
after a few days, you can reasonably assume that the other committers  
are OK with it.



Cheers

Andreas


Re: svn commit: r665699 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop: fo/flow/table/ layoutmgr/ layoutmgr/inline/ layoutmgr/list/ layoutmgr/table/

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Jeremias Maerki wrote:
> Frankly, I'm less than thrilled. I appreciate the good will behind this
> but I'd have appreciated some advance warning, too. My concern is that:
> -        ListElement last = (ListElement)contentList.getLast();
>
> is much easier to read and write than:
>
> +        ListElement last = (ListElement) contentList
> +                .get(contentList.size() - 1);
>
It may even be faster, unless LinkedList specifically optimizes
get(contentList.size() - 1).

Well, I think a List should be used if only List methods are needed,
and a specialized subclass should be used if methods of the subclass
have to be used.
Years ago, while I replaces Java 1.1 collection classes with 1.2 I
learned that replacing unnecessary use of specialized subclasses with
more generic classes without a tool is rather difficult. I vaguely
remember of a commercial tool which can report unnecessary use of
specialized subclasses (in general), as well as unnecessary broad
access control (i.e. public when protected is sufficient).
Does anybody of an open source tool which does this too?

J.Pietschmann

Re: svn commit: r665699 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop: fo/flow/table/ layoutmgr/ layoutmgr/inline/ layoutmgr/list/ layoutmgr/table/

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Thanks, Max, I guess I can live with a few helper methods, for example,
in ElementListUtils. Code readability and avoiding trivial coding
mistakes is important, especially in such a complex package as
"layoutmgr".

On 09.06.2008 18:56:52 Max Berger wrote:
> Jeremias,
> 
> actually I had the same reservations (especially about the "last  
> element", and if you have a real problem with this feel free to revert  
> this patch. Maybe we could write a simple helper method instead?
> 
> static Element getLastElement(List l) ?
> 
> Would that disperse your concerns?
> 
> Why I did it: For the exact reason that the interface is more  
> convenient. You are only partially right that LinkedList is the most  
> efficient interface: I was digging through the LayoutCode, and found  
> places where a single element list is created:
> 
> LinkedList l = new LinkedList()
> l.add(element)
> return l.
> 
> In this case, Collections.singletonList() is MUCH more effective.  
> AAMOF, on all list where you know the size beforehand (most cases in  
> the layout, becasue you know that x elemnets are going to result in x  
> layoutElements) arrayList is more effective.
> 
> 
> Background: I discovered that passing back multiple LayoutContexts is  
> not as easy as I thought, and I need to do some refactoring in the  
> layout code to ensure this is possible - therefore this (and the last  
> cleanup). I really need to make the code easier to read before I can  
> change it.
> 
> Max
> 
> 
> Am 09.06.2008 um 16:40 schrieb Jeremias Maerki:
> 
> > Frankly, I'm less than thrilled. I appreciate the good will behind  
> > this
> > but I'd have appreciated some advance warning, too. My concern is  
> > that:
> > -        ListElement last = (ListElement)contentList.getLast();
> >
> > is much easier to read and write than:
> >
> > +        ListElement last = (ListElement) contentList
> > +                .get(contentList.size() - 1);
> >
> > When working with element lists constructs like the above are  
> > everywhere.
> > A linked list IS the most efficient data structure for element  
> > lists. I
> > generally support using the generic type instead of the specific class
> > (i.e. List instead of ArrayList), but LinkedList is adding some often
> > used methods for element lists which improve code readability. I'm
> > curious what other committers think about this.
> >
> > On 09.06.2008 16:25:29 Adrian Cumiskey wrote:
> >> This is really good Max, really appreciate what you are trying to  
> >> do here.  It must have been quite
> >> boring and laborious...  but great cleanup work :).
> >>
> >> maxberger@apache.org wrote:
> >>> Author: maxberger
> >>> Date: Mon Jun  9 07:15:38 2008
> >>> New Revision: 665699
> >>>
> >>> URL: http://svn.apache.org/viewvc?rev=665699&view=rev
> >>> Log:
> >>> Replaced LinkedList with generic List interface
> >>>
> > <snip/>
> >
> > Jeremias Maerki
> >
> 




Jeremias Maerki


Re: svn commit: r665699 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop: fo/flow/table/ layoutmgr/ layoutmgr/inline/ layoutmgr/list/ layoutmgr/table/

Posted by Max Berger <ma...@berger.name>.
Jeremias,

actually I had the same reservations (especially about the "last  
element", and if you have a real problem with this feel free to revert  
this patch. Maybe we could write a simple helper method instead?

static Element getLastElement(List l) ?

Would that disperse your concerns?

Why I did it: For the exact reason that the interface is more  
convenient. You are only partially right that LinkedList is the most  
efficient interface: I was digging through the LayoutCode, and found  
places where a single element list is created:

LinkedList l = new LinkedList()
l.add(element)
return l.

In this case, Collections.singletonList() is MUCH more effective.  
AAMOF, on all list where you know the size beforehand (most cases in  
the layout, becasue you know that x elemnets are going to result in x  
layoutElements) arrayList is more effective.


Background: I discovered that passing back multiple LayoutContexts is  
not as easy as I thought, and I need to do some refactoring in the  
layout code to ensure this is possible - therefore this (and the last  
cleanup). I really need to make the code easier to read before I can  
change it.

Max


Am 09.06.2008 um 16:40 schrieb Jeremias Maerki:

> Frankly, I'm less than thrilled. I appreciate the good will behind  
> this
> but I'd have appreciated some advance warning, too. My concern is  
> that:
> -        ListElement last = (ListElement)contentList.getLast();
>
> is much easier to read and write than:
>
> +        ListElement last = (ListElement) contentList
> +                .get(contentList.size() - 1);
>
> When working with element lists constructs like the above are  
> everywhere.
> A linked list IS the most efficient data structure for element  
> lists. I
> generally support using the generic type instead of the specific class
> (i.e. List instead of ArrayList), but LinkedList is adding some often
> used methods for element lists which improve code readability. I'm
> curious what other committers think about this.
>
> On 09.06.2008 16:25:29 Adrian Cumiskey wrote:
>> This is really good Max, really appreciate what you are trying to  
>> do here.  It must have been quite
>> boring and laborious...  but great cleanup work :).
>>
>> maxberger@apache.org wrote:
>>> Author: maxberger
>>> Date: Mon Jun  9 07:15:38 2008
>>> New Revision: 665699
>>>
>>> URL: http://svn.apache.org/viewvc?rev=665699&view=rev
>>> Log:
>>> Replaced LinkedList with generic List interface
>>>
> <snip/>
>
> Jeremias Maerki
>


Re: svn commit: r665699 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop: fo/flow/table/ layoutmgr/ layoutmgr/inline/ layoutmgr/list/ layoutmgr/table/

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Frankly, I'm less than thrilled. I appreciate the good will behind this
but I'd have appreciated some advance warning, too. My concern is that:
-        ListElement last = (ListElement)contentList.getLast(); 

is much easier to read and write than:

+        ListElement last = (ListElement) contentList
+                .get(contentList.size() - 1); 

When working with element lists constructs like the above are everywhere.
A linked list IS the most efficient data structure for element lists. I
generally support using the generic type instead of the specific class
(i.e. List instead of ArrayList), but LinkedList is adding some often
used methods for element lists which improve code readability. I'm
curious what other committers think about this.

On 09.06.2008 16:25:29 Adrian Cumiskey wrote:
> This is really good Max, really appreciate what you are trying to do here.  It must have been quite 
> boring and laborious...  but great cleanup work :).
> 
> maxberger@apache.org wrote:
> > Author: maxberger
> > Date: Mon Jun  9 07:15:38 2008
> > New Revision: 665699
> > 
> > URL: http://svn.apache.org/viewvc?rev=665699&view=rev
> > Log:
> > Replaced LinkedList with generic List interface
> > 
<snip/>

Jeremias Maerki