1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright (c) 1999 by Sun Microsystems, Inc.
23  * All rights reserved.
24  *
25  */
26 
27 //  ServiceLocationEnumerator.java: Class implementing SLP enumerator.
28 //  Author:           James Kempf
29 //  Created On:       Thu May 21 14:36:55 1998
30 //  Last Modified By: James Kempf
31 //  Last Modified On: Thu May 21 14:37:21 1998
32 //  Update Count:     1
33 //
34 
35 package com.sun.slp;
36 
37 import java.util.*;
38 
39 /**
40  * The ServiceLocationEnumerator class implements an enumeration.
41  * Besides the standard Enumeration classes, it implements a next()
42  * method that can (but not in this implementation) throw a
43  * ServiceLocationException.
44  *
45  * @author James Kempf
46  */
47 
48 class ServiceLocationEnumerator extends Object
49     implements ServiceLocationEnumeration {
50 
51     // The base enumerator.
52 
53     Enumeration base;
54 
55     /**
56      * The constructor simply takes an enumerator on the vector.
57      */
58 
ServiceLocationEnumerator(Vector v)59     public ServiceLocationEnumerator(Vector v) {
60 
61 	if (v != null) {
62 	    base = v.elements();
63 	} else {
64 	    base = (new Vector()).elements();
65 	}
66     }
67 
68     /**
69      * Pass through to the Enumerator method.
70      */
71 
hasMoreElements()72     public boolean hasMoreElements() {
73 	return base.hasMoreElements();
74     }
75 
76     /**
77      * Pass through to the Enumerator method.
78      */
79 
nextElement()80     public Object nextElement() throws NoSuchElementException {
81 	return base.nextElement();
82     }
83 
84     /**
85      * Pass through to the Enumerator method.
86      */
87 
next()88     public Object next() throws ServiceLocationException {
89 	return base.nextElement();
90     }
91 
92 }
93