001: /*
002: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com> and
003: * JR Boyens <gnu-jrb[remove] at gmx dot net>
004: * Distributed under the terms of either:
005: * - the common development and distribution license (CDDL), v1.0; or
006: * - the GNU Lesser General Public License, v2.1 or later
007: * $Id: ManyToManyList.java 3634 2007-01-08 21:42:24Z gbevin $
008: */
009: package com.uwyn.rife.database.querymanagers.generic;
010:
011: import java.util.Collection;
012: import java.util.Iterator;
013: import java.util.List;
014: import java.util.ListIterator;
015:
016: class ManyToManyList<E> extends AbstractManyToManyCollection<E>
017: implements List<E> {
018: private List<E> mDelegate;
019:
020: ManyToManyList(AbstractGenericQueryManager manager,
021: String columnName1, int objectId,
022: ManyToManyDeclaration declaration) {
023: super (manager, columnName1, objectId, declaration);
024: }
025:
026: protected void ensurePopulatedDelegate() {
027: if (null == mDelegate) {
028: mDelegate = restoreManyToManyMappings();
029: }
030: }
031:
032: public int size() {
033: ensurePopulatedDelegate();
034: return mDelegate.size();
035: }
036:
037: public boolean isEmpty() {
038: ensurePopulatedDelegate();
039: return mDelegate.isEmpty();
040: }
041:
042: public boolean contains(Object o) {
043: ensurePopulatedDelegate();
044: return mDelegate.contains(o);
045: }
046:
047: public Iterator<E> iterator() {
048: ensurePopulatedDelegate();
049: return mDelegate.iterator();
050: }
051:
052: public Object[] toArray() {
053: ensurePopulatedDelegate();
054: return mDelegate.toArray();
055: }
056:
057: public <T extends Object> T[] toArray(T[] a) {
058: ensurePopulatedDelegate();
059: return mDelegate.toArray(a);
060: }
061:
062: public boolean add(E o) {
063: ensurePopulatedDelegate();
064: return mDelegate.add(o);
065: }
066:
067: public boolean remove(Object o) {
068: ensurePopulatedDelegate();
069: return mDelegate.remove(o);
070: }
071:
072: public boolean containsAll(Collection<?> c) {
073: ensurePopulatedDelegate();
074: return mDelegate.containsAll(c);
075: }
076:
077: public boolean addAll(Collection<? extends E> c) {
078: ensurePopulatedDelegate();
079: return mDelegate.addAll(c);
080: }
081:
082: public boolean addAll(int index, Collection<? extends E> c) {
083: ensurePopulatedDelegate();
084: return mDelegate.addAll(index, c);
085: }
086:
087: public boolean removeAll(Collection<?> c) {
088: ensurePopulatedDelegate();
089: return mDelegate.removeAll(c);
090: }
091:
092: public boolean retainAll(Collection<?> c) {
093: ensurePopulatedDelegate();
094: return mDelegate.retainAll(c);
095: }
096:
097: public void clear() {
098: ensurePopulatedDelegate();
099: mDelegate.clear();
100: }
101:
102: public E get(int index) {
103: ensurePopulatedDelegate();
104: return mDelegate.get(index);
105: }
106:
107: public E set(int index, E element) {
108: ensurePopulatedDelegate();
109: return mDelegate.set(index, element);
110: }
111:
112: public void add(int index, E element) {
113: ensurePopulatedDelegate();
114: mDelegate.add(index, element);
115: }
116:
117: public E remove(int index) {
118: ensurePopulatedDelegate();
119: return mDelegate.remove(index);
120: }
121:
122: public int indexOf(Object o) {
123: ensurePopulatedDelegate();
124: return mDelegate.indexOf(o);
125: }
126:
127: public int lastIndexOf(Object o) {
128: ensurePopulatedDelegate();
129: return mDelegate.lastIndexOf(o);
130: }
131:
132: public ListIterator<E> listIterator() {
133: ensurePopulatedDelegate();
134: return mDelegate.listIterator();
135: }
136:
137: public ListIterator<E> listIterator(int index) {
138: ensurePopulatedDelegate();
139: return mDelegate.listIterator(index);
140: }
141:
142: public List<E> subList(int fromIndex, int toIndex) {
143: ensurePopulatedDelegate();
144: return mDelegate.subList(fromIndex, toIndex);
145: }
146: }
|