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 org.mmbase.bridge.*;
14: import java.util.*;
15:
16: import org.mmbase.util.logging.*;
17:
18: /**
19: * A list of nodes, based on a Collection of Nodes
20: *
21: * @author Michiel Meeuwissen
22: * @version $Id: CollectionRelationList.java,v 1.6 2007/02/16 20:07:24 michiel Exp $
23: * @since MMBase-1.8
24: */
25: public class CollectionRelationList extends
26: AbstractCollectionNodeList<Relation> implements RelationList {
27:
28: private static final Logger log = Logging
29: .getLoggerInstance(CollectionRelationList.class);
30:
31: public CollectionRelationList(Collection c, NodeManager nodeManager) {
32: super (c, nodeManager);
33: }
34:
35: public CollectionRelationList(Collection c, Cloud cloud) {
36: super (c, cloud);
37: }
38:
39: public Relation getRelation(int index) {
40: return get(index);
41: }
42:
43: public CollectionRelationList subList(int fromIndex, int toIndex) {
44: return subRelationList(fromIndex, toIndex);
45: }
46:
47: public CollectionRelationList subRelationList(int fromIndex,
48: int toIndex) {
49: if (nodeManager != null) {
50: return new CollectionRelationList(subList(fromIndex,
51: toIndex), nodeManager);
52: } else {
53: return new CollectionRelationList(subList(fromIndex,
54: toIndex), cloud);
55: }
56: }
57:
58: public RelationIterator relationIterator() {
59: return new BasicRelationIterator();
60: }
61:
62: protected class BasicRelationIterator extends BasicIterator
63: implements RelationIterator {
64:
65: public Relation nextRelation() {
66: return next();
67: }
68:
69: public Relation previousRelation() {
70: return previous();
71: }
72: }
73: }
|