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.implementation;
12:
13: import java.util.Collection;
14:
15: import org.mmbase.bridge.*;
16:
17: /**
18: * A list of nodes
19: *
20: * @author Pierre van Rooden
21: * @version $Id: BasicNodeList.java,v 1.53 2007/03/30 13:08:37 michiel Exp $
22: */
23: public class BasicNodeList extends AbstractNodeList<Node> implements
24: NodeList {
25:
26: BasicNodeList() {
27: super ();
28: }
29:
30: public BasicNodeList(Collection c, Cloud cloud) {
31: super (c, cloud);
32: }
33:
34: BasicNodeList(Collection c, NodeManager nodeManager) {
35: super (c, nodeManager);
36: }
37:
38: @Override
39: protected Node convert(Object o) {
40: if (o instanceof Node || o == null) {
41: return (Node) o;
42: }
43: return super .convert(o);
44: }
45:
46: public Node getNode(int index) {
47: return get(index);
48: }
49:
50: public NodeList subNodeList(int fromIndex, int toIndex) {
51: if (nodeManager != null) {
52: return new BasicNodeList(subList(fromIndex, toIndex),
53: nodeManager);
54: } else {
55: return new BasicNodeList(subList(fromIndex, toIndex), cloud);
56: }
57: }
58:
59: public NodeIterator nodeIterator() {
60: return new BasicNodeIterator();
61: }
62:
63: protected class BasicNodeIterator extends BasicIterator implements
64: NodeIterator {
65:
66: public Node nextNode() {
67: return next();
68: }
69:
70: public Node previousNode() {
71: return previous();
72: }
73: }
74: }
|