KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > rift > coad > lib > naming > cos > MemoryNamingEnumeration


1 /*
2  * CoadunationLib: The coaduntion implementation library.
3  * Copyright (C) 2006 Rift IT Contracting
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19  * MemoryNamingEnumeration.java
20  *
21  * This object implements the Naming enumeration for the memory context.
22  */

23
24 // package path
25
package com.rift.coad.lib.naming.cos;
26
27 // java imports
28
import java.util.Enumeration JavaDoc;
29 import javax.naming.NamingEnumeration JavaDoc;
30
31 /**
32  * This object implements the Naming enumeration for the memory context.
33  *
34  * @author Brett Chaldecott
35  */

36 public class MemoryNamingEnumeration implements NamingEnumeration JavaDoc {
37     
38     // private member variables
39
private Enumeration JavaDoc enumer = null;
40     
41     /**
42      * Creates a new instance of MemoryNamingEnumeration
43      *
44      * @param enumer The enumeration reference being wrapped
45      */

46     public MemoryNamingEnumeration(Enumeration JavaDoc enumer) {
47         this.enumer = enumer;
48     }
49     
50     
51     /**
52      * Closes this enumeration.
53      */

54     public void close() {
55         
56     }
57     
58     /**
59      * Determines whether there are any more elements in the enumeration.
60      *
61      * @return True if there are more elements.
62      */

63     public boolean hasMore() {
64         return enumer.hasMoreElements();
65     }
66     
67     
68     /**
69      * Retrieves the next element in the enumeration.
70      *
71      * @return The next object
72      */

73     public Object JavaDoc next() {
74         return enumer.nextElement();
75     }
76     
77     
78     /**
79      * Tests if this enumeration contains more elements.
80      *
81      * @return boolean True if has element false if not.
82      */

83     public boolean hasMoreElements() {
84         return enumer.hasMoreElements();
85     }
86     
87     
88     /**
89      * Returns the next element of this enumeration if this enumeration object
90      * has at least one more element to provide.
91      *
92      * @return The next element;
93      */

94     public Object JavaDoc nextElement() {
95         return enumer.nextElement();
96     }
97 }
98
Popular Tags