1 10 11 package org.mmbase.bridge.util; 12 13 import org.mmbase.bridge.*; 14 import java.util.*; 15 import org.mmbase.util.logging.*; 16 17 24 public class CollectionRelationList extends CollectionNodeList implements RelationList { 25 26 private static final Logger log = Logging.getLoggerInstance(CollectionRelationList.class); 27 28 29 public CollectionRelationList(Collection c, NodeManager nodeManager) { 30 super(c, nodeManager); 31 } 32 33 34 public CollectionRelationList(Collection c, Cloud cloud) { 35 super(c, cloud); 36 } 37 38 protected Object validate(Object o) throws ClassCastException ,IllegalArgumentException { 39 return (Relation)o; 40 } 41 44 public Relation getRelation(int index) { 45 return (Relation)get(index); 46 } 47 48 51 public RelationList subRelationList(int fromIndex, int toIndex) { 52 if (nodeManager != null) { 53 return new CollectionRelationList(subList(fromIndex, toIndex), nodeManager); 54 } else { 55 return new CollectionRelationList(subList(fromIndex, toIndex), cloud); 56 } 57 } 58 59 62 public RelationIterator relationIterator() { 63 return new BasicRelationIterator(); 64 } 65 66 protected class BasicRelationIterator extends BasicNodeIterator implements RelationIterator { 67 68 public Relation nextRelation() { 69 return (Relation)next(); 70 } 71 72 public Relation previousRelation() { 73 return (Relation)previous(); 74 } 75 } 76 } 77 | Popular Tags |