| %line | %branch | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| org.apache.commons.jexl.util.EnumerationIterator |
|
|
| 1 | /* |
|
| 2 | * Copyright 1999-2001,2004 The Apache Software Foundation. |
|
| 3 | * |
|
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 | * you may not use this file except in compliance with the License. |
|
| 6 | * You may obtain a copy of the License at |
|
| 7 | * |
|
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 9 | * |
|
| 10 | * Unless required by applicable law or agreed to in writing, software |
|
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 13 | * See the License for the specific language governing permissions and |
|
| 14 | * limitations under the License. |
|
| 15 | */ |
|
| 16 | ||
| 17 | package org.apache.commons.jexl.util; |
|
| 18 | ||
| 19 | ||
| 20 | import java.util.Iterator; |
|
| 21 | import java.util.Enumeration; |
|
| 22 | ||
| 23 | /** |
|
| 24 | * An Iterator wrapper for an Enumeration. |
|
| 25 | * |
|
| 26 | * @since 1.0 |
|
| 27 | * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a> |
|
| 28 | * @version $Id: EnumerationIterator.java 398330 2006-04-30 12:52:35Z dion $ |
|
| 29 | */ |
|
| 30 | public class EnumerationIterator implements Iterator { |
|
| 31 | /** |
|
| 32 | * The enumeration to iterate over. |
|
| 33 | */ |
|
| 34 | private final Enumeration enumeration; |
|
| 35 | ||
| 36 | /** |
|
| 37 | * Creates a new iteratorwrapper instance for the specified |
|
| 38 | * Enumeration. |
|
| 39 | * |
|
| 40 | * @param enumer The Enumeration to wrap. |
|
| 41 | */ |
|
| 42 | 1 | public EnumerationIterator(Enumeration enumer) { |
| 43 | 1 | enumeration = enumer; |
| 44 | 1 | } |
| 45 | ||
| 46 | /** |
|
| 47 | * Move to next element in the array. |
|
| 48 | * |
|
| 49 | * @return The next object in the array. |
|
| 50 | */ |
|
| 51 | public Object next() { |
|
| 52 | 2 | return enumeration.nextElement(); |
| 53 | } |
|
| 54 | ||
| 55 | /** |
|
| 56 | * Check to see if there is another element in the array. |
|
| 57 | * |
|
| 58 | * @return Whether there is another element. |
|
| 59 | */ |
|
| 60 | public boolean hasNext() { |
|
| 61 | 3 | return enumeration.hasMoreElements(); |
| 62 | } |
|
| 63 | ||
| 64 | /** |
|
| 65 | * Unimplemented. No analogy in Enumeration |
|
| 66 | */ |
|
| 67 | public void remove() { |
|
| 68 | // not implemented |
|
| 69 | 0 | } |
| 70 | ||
| 71 | } |
| This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |