KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > core > jdom > SiblingEnumeration


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.core.jdom;
12
13 import java.util.Enumeration JavaDoc;
14
15 import org.eclipse.jdt.core.jdom.*;
16
17 /**
18  * SiblingEnumeration provides an enumeration on a linked list
19  * of sibling DOM nodes.
20  *
21  * @see java.util.Enumeration
22  * @deprecated The JDOM was made obsolete by the addition in 2.0 of the more
23  * powerful, fine-grained DOM/AST API found in the
24  * org.eclipse.jdt.core.dom package.
25  */

26 /* package */ class SiblingEnumeration implements Enumeration JavaDoc {
27
28     /**
29      * The current location in the linked list
30      * of DOM nodes.
31      */

32     protected IDOMNode fCurrentElement;
33 /**
34  * Creates an enumeration of silbings starting at the given node.
35  * If the given node is <code>null</code> the enumeration is empty.
36  */

37 SiblingEnumeration(IDOMNode child) {
38     fCurrentElement= child;
39 }
40 /**
41  * @see java.util.Enumeration#hasMoreElements()
42  */

43 public boolean hasMoreElements() {
44     return fCurrentElement != null;
45 }
46 /**
47  * @see java.util.Enumeration#nextElement()
48  */

49 public Object JavaDoc nextElement() {
50     IDOMNode curr= fCurrentElement;
51     if (curr != null) {
52         fCurrentElement= fCurrentElement.getNextNode();
53     }
54     return curr;
55 }
56 }
57
Popular Tags