01: /*
02: * CoadunationLib: The coaduntion implementation library.
03: * Copyright (C) 2006 Rift IT Contracting
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation; either
08: * version 2.1 of the License, or (at your option) any later version.
09: *
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;
29: import javax.naming.NamingEnumeration;
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 {
37:
38: // private member variables
39: private Enumeration 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 enumer) {
47: this .enumer = enumer;
48: }
49:
50: /**
51: * Closes this enumeration.
52: */
53: public void close() {
54:
55: }
56:
57: /**
58: * Determines whether there are any more elements in the enumeration.
59: *
60: * @return True if there are more elements.
61: */
62: public boolean hasMore() {
63: return enumer.hasMoreElements();
64: }
65:
66: /**
67: * Retrieves the next element in the enumeration.
68: *
69: * @return The next object
70: */
71: public Object next() {
72: return enumer.nextElement();
73: }
74:
75: /**
76: * Tests if this enumeration contains more elements.
77: *
78: * @return boolean True if has element false if not.
79: */
80: public boolean hasMoreElements() {
81: return enumer.hasMoreElements();
82: }
83:
84: /**
85: * Returns the next element of this enumeration if this enumeration object
86: * has at least one more element to provide.
87: *
88: * @return The next element;
89: */
90: public Object nextElement() {
91: return enumer.nextElement();
92: }
93: }
|