You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by gm...@apache.org on 2004/09/19 20:46:51 UTC

cvs commit: xml-fop/src/java/org/apache/fop/fo CharIterator.java FOText.java OneCharIterator.java RecursiveCharIterator.java AbstractCharIterator.java

gmazza      2004/09/19 11:46:51

  Modified:    src/java/org/apache/fop/area AreaTreeModel.java
                        StorePagesModel.java
               src/java/org/apache/fop/fo CharIterator.java FOText.java
                        OneCharIterator.java RecursiveCharIterator.java
  Removed:     src/java/org/apache/fop/fo AbstractCharIterator.java
  Log:
  1.)  Removed unused getTitle() within AreaTreeModel; I believe can be obtained
  from fo.pagination.PageSequence object where needed.
  
  2.)  Combined AbstractCharIterator and CharIterator interface into single
  abstract CharIterator class.
  
  Revision  Changes    Path
  1.4       +0 -7      xml-fop/src/java/org/apache/fop/area/AreaTreeModel.java
  
  Index: AreaTreeModel.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/AreaTreeModel.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AreaTreeModel.java	7 Jul 2004 01:51:50 -0000	1.3
  +++ AreaTreeModel.java	19 Sep 2004 18:46:51 -0000	1.4
  @@ -61,13 +61,6 @@
       public abstract int getPageSequenceCount();
   
       /**
  -     * Get the title for a page sequence.
  -     * @param count the page sequence count
  -     * @return the title of the page sequence
  -     */
  -    public abstract Title getTitle(int count);
  -
  -    /**
        * Get the page count.
        * @param seq the page sequence to count.
        * @return returns the number of pages in a page sequence
  
  
  
  1.5       +0 -9      xml-fop/src/java/org/apache/fop/area/StorePagesModel.java
  
  Index: StorePagesModel.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/StorePagesModel.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- StorePagesModel.java	7 Jul 2004 01:51:50 -0000	1.4
  +++ StorePagesModel.java	19 Sep 2004 18:46:51 -0000	1.5
  @@ -73,15 +73,6 @@
       }
   
       /**
  -     * Get the title for a page sequence.
  -     * @param count the page sequence count
  -     * @return the title of the page sequence
  -     */
  -    public Title getTitle(int count) {
  -        return (Title) titles.get(count);
  -    }
  -
  -    /**
        * Get the page count.
        * @param seq the page sequence to count.
        * @return returns the number of pages in a page sequence
  
  
  
  1.4       +37 -9     xml-fop/src/java/org/apache/fop/fo/CharIterator.java
  
  Index: CharIterator.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/CharIterator.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CharIterator.java	27 Feb 2004 17:57:40 -0000	1.3
  +++ CharIterator.java	19 Sep 2004 18:46:51 -0000	1.4
  @@ -15,35 +15,63 @@
    */
   
   /* $Id$ */
  -
  + 
   package org.apache.fop.fo;
   
   import java.util.Iterator;
   import java.util.NoSuchElementException;
   
   /**
  - * Interface for iterators that should iterate through a series of characters.
  - * Extends the java.util.Iterator interface with some additional functions
  - * useful for FOP's management of text.
  + * Abstract base class for iterators that should iterate through a series
  + * of characters.  Extends the java.util.Iterator interface with some
  + * additional functions useful for FOP's management of text.
    */
  -public interface CharIterator extends Iterator {
  +public abstract class CharIterator implements Iterator, Cloneable {
  +
  +    /**
  +     * @see java.util.Iterator#hasNext()
  +     */
  +    public abstract boolean hasNext();
   
       /**
        * @return the character that is the next character in the collection
        * @throws NoSuchElementException if there are no more characters (test for
        * this condition with java.util.Iterator.hasNext()).
        */
  -    char nextChar() throws NoSuchElementException ;
  +    public abstract char nextChar() throws NoSuchElementException;
  +
  +    /**
  +     * @see java.util.Iterator#next()
  +     */
  +    public Object next() throws NoSuchElementException {
  +        return new Character(nextChar());
  +    }
  +
  +    /**
  +     * @see java.util.Iterator#remove()
  +     */
  +    public void remove() {
  +        throw new UnsupportedOperationException();
  +    }
  +
   
       /**
        * Replace the current character managed by the iterator with a specified
        * character?
        * @param c character
        */
  -    void replaceChar(char c);
  +    public void replaceChar(char c) {
  +    }
   
       /**
  -     * @return cloned Object
  +     * @see java.lang.Object#clone()
        */
  -    Object clone();
  +    public Object clone() {
  +        try {
  +            return super.clone();
  +        } catch (CloneNotSupportedException ex) {
  +            return null;
  +        }
  +    }
   }
  +
  
  
  
  1.26      +1 -1      xml-fop/src/java/org/apache/fop/fo/FOText.java
  
  Index: FOText.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FOText.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- FOText.java	11 Sep 2004 17:11:59 -0000	1.25
  +++ FOText.java	19 Sep 2004 18:46:51 -0000	1.26
  @@ -432,7 +432,7 @@
           }
       }
   
  -    private class TextCharIterator extends AbstractCharIterator {
  +    private class TextCharIterator extends CharIterator {
           private int curIndex = 0;
   
           /* Current space removal process:  just increment the startIndex
  
  
  
  1.4       +1 -1      xml-fop/src/java/org/apache/fop/fo/OneCharIterator.java
  
  Index: OneCharIterator.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/OneCharIterator.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- OneCharIterator.java	27 Feb 2004 17:57:40 -0000	1.3
  +++ OneCharIterator.java	19 Sep 2004 18:46:51 -0000	1.4
  @@ -23,7 +23,7 @@
   /**
    * Class providing an iterator for one character.
    */
  -public class OneCharIterator extends AbstractCharIterator {
  +public class OneCharIterator extends CharIterator {
   
       private boolean bFirst = true;
       private char charCode;
  
  
  
  1.5       +1 -1      xml-fop/src/java/org/apache/fop/fo/RecursiveCharIterator.java
  
  Index: RecursiveCharIterator.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/RecursiveCharIterator.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- RecursiveCharIterator.java	24 Jul 2004 22:56:30 -0000	1.4
  +++ RecursiveCharIterator.java	19 Sep 2004 18:46:51 -0000	1.5
  @@ -27,7 +27,7 @@
    * class is itself a CharIterator, and manages a collection of CharIterators, it
    * is easy to get confused.
    */
  -public class RecursiveCharIterator extends AbstractCharIterator {
  +public class RecursiveCharIterator extends CharIterator {
       /** parent node for whose child nodes this iterator iterates */
       private FONode fobj;
       /** iterator for the child nodes */
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org


Re: cvs commit: xml-fop/src/java/org/apache/fop/fo CharIterator.java FOText.java OneCharIterator.java RecursiveCharIterator.java AbstractCharIterator.java

Posted by Glen Mazza <gr...@yahoo.com>.
Simon Pepping wrote:

>On Sun, Sep 19, 2004 at 06:46:51PM -0000, gmazza@apache.org wrote:
>  
>
>>gmazza      2004/09/19 11:46:51
>>
>>  Modified:    src/java/org/apache/fop/area AreaTreeModel.java
>>                        StorePagesModel.java
>>               src/java/org/apache/fop/fo CharIterator.java FOText.java
>>                        OneCharIterator.java RecursiveCharIterator.java
>>  Removed:     src/java/org/apache/fop/fo AbstractCharIterator.java
>>  Log:
>>  1.)  Removed unused getTitle() within AreaTreeModel; I believe can be obtained
>>  from fo.pagination.PageSequence object where needed.
>>    
>>
>
>PageSequence is an FO node. It can at best provide the title FO
>node. getTitle() provides the Title area. Perhaps it is there for the
>convenience of renderers?
>  
>

Good point--I just returned it.  (Although I would prefer moving the 
title area calculation code from AreaTreeHandler to AreaTreeModel--I 
would rather ATH not get burdened with this type of detail.)

>   
>  
>
>>  2.)  Combined AbstractCharIterator and CharIterator interface into single
>>  abstract CharIterator class.
>>    
>>
>   
>Don't you believe in the separation of Interface and abstract
>implementing superclass? If AbstractCharIterator adds nothing to the
>interface, it is better to remove this abstract superclass. It does
>implement a few methods, though.
>
>  
>

Most certainly, with LayoutManager and Renderer and in other advanced 
instances.  Not in every possible theoretical case, however; I chose 
simplicity here though due to the limited external usage and smallness 
of the classes.

Glen


Re: cvs commit: xml-fop/src/java/org/apache/fop/fo CharIterator.java FOText.java OneCharIterator.java RecursiveCharIterator.java AbstractCharIterator.java

Posted by Simon Pepping <sp...@leverkruid.nl>.
On Sun, Sep 19, 2004 at 06:46:51PM -0000, gmazza@apache.org wrote:
> gmazza      2004/09/19 11:46:51
> 
>   Modified:    src/java/org/apache/fop/area AreaTreeModel.java
>                         StorePagesModel.java
>                src/java/org/apache/fop/fo CharIterator.java FOText.java
>                         OneCharIterator.java RecursiveCharIterator.java
>   Removed:     src/java/org/apache/fop/fo AbstractCharIterator.java
>   Log:
>   1.)  Removed unused getTitle() within AreaTreeModel; I believe can be obtained
>   from fo.pagination.PageSequence object where needed.

PageSequence is an FO node. It can at best provide the title FO
node. getTitle() provides the Title area. Perhaps it is there for the
convenience of renderers?
   
>   2.)  Combined AbstractCharIterator and CharIterator interface into single
>   abstract CharIterator class.
   
Don't you believe in the separation of Interface and abstract
implementing superclass? If AbstractCharIterator adds nothing to the
interface, it is better to remove this abstract superclass. It does
implement a few methods, though.

Regards, Simon

-- 
Simon Pepping
home page: http://www.leverkruid.nl