new version with WorkingCopy Management
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / core / jdom / SiblingEnumeration.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2003 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials 
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package net.sourceforge.phpdt.internal.core.jdom;
12
13 import java.util.Enumeration;
14
15 import net.sourceforge.phpdt.core.jdom.IDOMNode;
16
17 /**
18  * SiblingEnumeration provides an enumeration on a linked list
19  * of sibling DOM nodes.
20  *
21  * @see java.util.Enumeration
22  */
23
24 /* package */ class SiblingEnumeration implements Enumeration {
25
26         /**
27          * The current location in the linked list
28          * of DOM nodes.
29          */
30         protected IDOMNode fCurrentElement;
31 /**
32  * Creates an enumeration of silbings starting at the given node.
33  * If the given node is <code>null</code> the enumeration is empty.
34  */
35 SiblingEnumeration(IDOMNode child) {
36         fCurrentElement= child;
37 }
38 /**
39  * @see java.util.Enumeration#hasMoreElements()
40  */
41 public boolean hasMoreElements() {
42         return fCurrentElement != null;
43 }
44 /**
45  * @see java.util.Enumeration#nextElement()
46  */
47 public Object nextElement() {
48         IDOMNode curr=  fCurrentElement;
49         if (curr != null) {
50                 fCurrentElement= fCurrentElement.getNextNode();
51         }
52         return curr;
53 }
54 }