Clover coverage report - JBind Project
Coverage timestamp: Fr Mai 28 2004 11:17:36 CEST
file stats: LOC: 63   Methods: 5
NCLOC: 34   Classes: 1
This license of Clover is provided to support the development of JBind only. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover.
 
 Source file Conditionals Statements Methods TOTAL
ConcatIterator.java 100% 92,3% 80% 90,9%
 1   
 /*
 2   
  * JBind
 3   
  *
 4   
  * Copyright (c) by Stefan Wachter. All rights reserved.
 5   
  *
 6   
  * Usage, modification, and redistribution is subject to license terms that are
 7   
  * available at 'http://www.jbind.org'. The JBind license is like the
 8   
  * 'Apache Software License V 1.1'.
 9   
  */
 10   
 /*
 11   
  * EnumerationUnion.java
 12   
  *
 13   
  * Created on 28. April 2000, 11:35
 14   
  */
 15   
 
 16   
 package org.jbind.util.collection;
 17   
 
 18   
 import java.util.ArrayList;
 19   
 import java.util.Iterator;
 20   
 import java.util.List;
 21   
 
 22   
 /**
 23   
  * Concatenates an array of iterators to one iterator.
 24   
  *
 25   
  * @author  Wachter
 26   
  */
 27   
 public class ConcatIterator implements Iterator {
 28   
 
 29   
   private List iterators;
 30   
   private int currentIterator = 0;
 31   
 
 32  72
   public ConcatIterator(List anIterators) {
 33  72
     iterators = anIterators;
 34   
   }
 35   
 
 36  4966
   public ConcatIterator(Iterator anI1, Iterator anI2) {
 37  4966
     iterators = new ArrayList();
 38  4966
     iterators.add(anI1);
 39  4966
     iterators.add(anI2);
 40   
   }
 41   
 
 42  93
   public Object next() {
 43  93
     return ((Iterator)iterators.get(currentIterator)).next();
 44   
   }
 45   
 
 46  15109
   public boolean hasNext() {
 47  15109
     boolean hasNext = false;
 48  15109
     if (currentIterator < iterators.size()) {
 49  10071
       if (((Iterator)iterators.get(currentIterator)).hasNext()) {
 50  93
         hasNext = true;
 51   
       } else {
 52  9978
         currentIterator++;
 53  9978
         hasNext = hasNext();
 54   
       }
 55   
     }
 56  15109
     return hasNext;
 57   
   }
 58   
 
 59  0
   public void remove() {
 60  0
     ((Iterator)iterators.get(currentIterator)).remove();
 61   
   }
 62   
 }
 63