01: /*
02:
03: This software is OSI Certified Open Source Software.
04: OSI Certified is a certification mark of the Open Source Initiative.
05:
06: The license (Mozilla version 1.0) can be read at the MMBase site.
07: See http://www.MMBase.org/license
08:
09: */
10:
11: package org.mmbase.bridge.util;
12:
13: import java.util.Collection;
14:
15: import org.mmbase.bridge.*;
16:
17: /**
18: * A (fixed-size) list of nodes, based on a Collection of Nodes. If the collection is a List it
19: * will mirror its' changes. Otherwise, no, because the complete collection is inserted in its own
20: * one.
21: *
22: * @author Michiel Meeuwissen
23: * @version $Id: CollectionNodeList.java,v 1.11 2007/02/16 20:06:58 michiel Exp $
24: * @since MMBase-1.8
25: */
26: public class CollectionNodeList extends
27: AbstractCollectionNodeList<Node> implements NodeList {
28:
29: public CollectionNodeList(Collection c, NodeManager nodeManager) {
30: super (c, nodeManager);
31: }
32:
33: public CollectionNodeList(Collection c, Cloud cloud) {
34: super (c, cloud);
35: }
36:
37: public CollectionNodeList(Collection c) {
38: super (c, (Cloud) null);
39: }
40:
41: public Node getNode(int index) {
42: return get(index);
43: }
44:
45: public NodeList subNodeList(int fromIndex, int toIndex) {
46: return subList(fromIndex, toIndex);
47: }
48:
49: public CollectionNodeList subList(int fromIndex, int toIndex) {
50: return new CollectionNodeList(wrappedCollection.subList(
51: fromIndex, toIndex));
52: }
53:
54: public NodeIterator nodeIterator() {
55: return new BasicNodeIterator();
56: }
57:
58: protected class BasicNodeIterator extends BasicIterator implements
59: NodeIterator {
60:
61: public Node nextNode() {
62: return next();
63: }
64:
65: public Node previousNode() {
66: return previous();
67: }
68: }
69: }
|