01: /* Copyright 2005 The JA-SIG Collaborative. All rights reserved.
02: * See license distributed with this file and
03: * available online at http://www.uportal.org/license.html
04: */
05:
06: package org.jasig.portal.layout.dlm;
07:
08: import java.util.Enumeration;
09: import java.util.NoSuchElementException;
10:
11: /**
12: * @version $Revision: 35705 $ $Date: 2005-05-01 20:14:20 -0700 (Sun, 01 May 2005) $
13: * @since uPortal 2.5
14: */
15: public class CompositeEnumeration implements Enumeration {
16: public static final String RCS_ID = "@(#) $Header$";
17:
18: private Enumeration first = null;
19: private Enumeration second = null;
20:
21: /**
22: * Constructs an enumeration object that enumerates over the elements
23: * in the first passed in enumeration object and then enumerates over
24: * those in the second passed in enumeration object.
25: */
26: CompositeEnumeration(Enumeration first, Enumeration second) {
27: this .first = first;
28: this .second = second;
29: }
30:
31: public boolean hasMoreElements() {
32: return first.hasMoreElements() || second.hasMoreElements();
33: }
34:
35: public Object nextElement() throws NoSuchElementException {
36: if (first.hasMoreElements())
37: return first.nextElement();
38: return second.nextElement();
39: }
40: }
|