001: package com.mockrunner.mock.connector.cci;
002:
003: import java.util.ArrayList;
004: import java.util.Collection;
005: import java.util.Iterator;
006: import java.util.List;
007: import java.util.ListIterator;
008:
009: import javax.resource.cci.IndexedRecord;
010:
011: import com.mockrunner.base.NestedApplicationException;
012:
013: /**
014: * Mock implementation of <code>IndexedRecord</code>.
015: */
016: public class MockIndexedRecord extends MockRecord implements
017: IndexedRecord {
018: private List backingList;
019:
020: public MockIndexedRecord() {
021: this ("MockrunnerGenericIndexedRecord");
022: }
023:
024: public MockIndexedRecord(String name) {
025: this (name, name);
026: }
027:
028: public MockIndexedRecord(String name, String description) {
029: super (name, description);
030: backingList = new ArrayList();
031: }
032:
033: public int size() {
034: return backingList.size();
035: }
036:
037: public boolean isEmpty() {
038: return backingList.isEmpty();
039: }
040:
041: public boolean contains(Object object) {
042: return backingList.contains(object);
043: }
044:
045: public Iterator iterator() {
046: return backingList.iterator();
047: }
048:
049: public Object[] toArray() {
050: return backingList.toArray();
051: }
052:
053: public Object[] toArray(Object[] object) {
054: return backingList.toArray(object);
055: }
056:
057: public boolean add(Object object) {
058: return backingList.add(object);
059: }
060:
061: public boolean remove(Object object) {
062: return backingList.remove(object);
063: }
064:
065: public boolean containsAll(Collection collection) {
066: return backingList.containsAll(collection);
067: }
068:
069: public boolean addAll(Collection collection) {
070: return backingList.addAll(collection);
071: }
072:
073: public boolean addAll(int index, Collection collection) {
074: return backingList.addAll(index, collection);
075: }
076:
077: public boolean removeAll(Collection collection) {
078: return backingList.removeAll(collection);
079: }
080:
081: public boolean retainAll(Collection collection) {
082: return backingList.retainAll(collection);
083: }
084:
085: public void clear() {
086: backingList.clear();
087: }
088:
089: public Object get(int index) {
090: return backingList.get(index);
091: }
092:
093: public Object set(int index, Object object) {
094: return backingList.set(index, object);
095: }
096:
097: public void add(int index, Object object) {
098: backingList.add(index, object);
099: }
100:
101: public Object remove(int index) {
102: return backingList.remove(index);
103: }
104:
105: public int indexOf(Object object) {
106: return backingList.indexOf(object);
107: }
108:
109: public int lastIndexOf(Object object) {
110: return backingList.lastIndexOf(object);
111: }
112:
113: public ListIterator listIterator() {
114: return backingList.listIterator();
115: }
116:
117: public ListIterator listIterator(int index) {
118: return backingList.listIterator(index);
119: }
120:
121: public List subList(int fromIndex, int toIndex) {
122: return backingList.subList(fromIndex, toIndex);
123: }
124:
125: public boolean equals(Object object) {
126: if (!super .equals(object))
127: return false;
128: MockIndexedRecord other = (MockIndexedRecord) object;
129: return backingList.equals(other.backingList);
130: }
131:
132: public int hashCode() {
133: return super .hashCode() * 31 + backingList.hashCode();
134: }
135:
136: public String toString() {
137: return super .toString() + "\n" + backingList.toString();
138: }
139:
140: public Object clone() {
141: try {
142: MockIndexedRecord clone = (MockIndexedRecord) super .clone();
143: clone.backingList = new ArrayList(this .backingList);
144: return clone;
145: } catch (Exception exc) {
146: throw new NestedApplicationException(exc);
147: }
148: }
149: }
|