pbwest      2004/02/04 04:17:51

  Modified:    src/java/org/apache/fop/datastructs Tag:
                        FOP_0-20-0_Alt-Design Node.java
  Log:
  Added private method hasNextNode() as the implementation
  of hasNode().  Made constructors refer to this method to
  bypass scope problems in the superclass constructor for
  SyncedNode.PreOrder, etc.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.1.2.7   +17 -9     xml-fop/src/java/org/apache/fop/datastructs/Attic/Node.java
  
  Index: Node.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/datastructs/Attic/Node.java,v
  retrieving revision 1.1.2.6
  retrieving revision 1.1.2.7
  diff -u -r1.1.2.6 -r1.1.2.7
  --- Node.java 1 Feb 2004 08:12:00 -0000       1.1.2.6
  +++ Node.java 4 Feb 2004 12:17:51 -0000       1.1.2.7
  @@ -528,7 +528,7 @@
            * Constructor for pre-order iterator.
            */
           public PreOrder() {
  -            hasNext();  // A call to set up the initial iterators
  +            hasNextNode();  // A call to set up the initial iterators
               // so that a call to next() without a preceding call to
               // hasNext() will behave sanely
           }
  @@ -538,19 +538,23 @@
            */
           public PreOrder(Object sync) {
               synchronized (sync) {
  -                hasNext();  // A call to set up the initial iterators
  +                hasNextNode();  // A call to set up the initial iterators
                   // so that a call to next() without a preceding call to
                   // hasNext() will behave sanely
               }
           }
           
           public boolean hasNext() {
  +            return hasNextNode();
  +        }
  +        
  +        private boolean hasNextNode() {
               if (selfNotReturned) {
                   return true;
               }
               // self has been returned - are there any children?
               // if so, we must always have an iterator available
  -            // even unless it is exhausted.  Assume it is set up this 
  +            // even if it is exhausted.  Assume it is set up this 
               // way by next().  The iterator has a chance to do this 
               // because self will always be returned first.
               // The test of nextChildIndex must always be made because
  @@ -566,7 +570,7 @@
           }
   
           public Object next() {
  -            if (! hasNext()) {
  +            if (! hasNextNode()) {
                   throw new NoSuchElementException();
               }
               if (selfNotReturned) {
  @@ -640,7 +644,7 @@
            * Constructor for post-order iterator.
            */
           public PostOrder() {
  -            hasNext();  // A call to set up the initial iterators
  +            hasNextNode();  // A call to set up the initial iterators
               // so that a call to next() without a preceding call to
               // hasNext() will behave sanely
           }
  @@ -651,13 +655,17 @@
            */
           public PostOrder(Object sync) {
               synchronized (sync) {
  -                hasNext();  // A call to set up the initial iterators
  +                hasNextNode();  // A call to set up the initial iterators
                   // so that a call to next() without a preceding call to
                   // hasNext() will behave sanely
               }
           }
           
           public boolean hasNext() {
  +            return hasNextNode();
  +        }
  +        
  +        private boolean hasNextNode() {
               // self is always the last to go
               if (selfReturned) { // nothing left
                   return false;
  @@ -677,7 +685,7 @@
           }
   
           public Object next() throws NoSuchElementException {
  -            if (! hasNext()) {
  +            if (! hasNextNode()) {
                   throw new NoSuchElementException();
               }
               // Are there any children?
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to