001: /*
002: * <copyright>
003: *
004: * Copyright 1997-2004 BBNT Solutions, LLC
005: * under sponsorship of the Defense Advanced Research Projects
006: * Agency (DARPA).
007: *
008: * You can redistribute this software and/or modify it under the
009: * terms of the Cougaar Open Source License as published on the
010: * Cougaar Open Source Website (www.cougaar.org).
011: *
012: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
013: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
014: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
015: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
016: * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
017: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
018: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
019: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
020: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
021: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
022: * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
023: *
024: * </copyright>
025: */
026:
027: package org.cougaar.util;
028:
029: import java.util.Collection;
030: import java.util.Iterator;
031:
032: public class CollectionDelegate implements Collection {
033: protected Collection inner;
034:
035: public CollectionDelegate(Collection realCollection) {
036: inner = realCollection;
037: }
038:
039: public boolean add(Object o) {
040: return inner.add(o);
041: }
042:
043: public boolean addAll(Collection c) {
044: return inner.addAll(c);
045: }
046:
047: public void clear() {
048: inner.clear();
049: }
050:
051: public boolean contains(Object o) {
052: return inner.contains(o);
053: }
054:
055: public boolean containsAll(Collection c) {
056: return inner.containsAll(c);
057: }
058:
059: public boolean isEmpty() {
060: return inner.isEmpty();
061: }
062:
063: public Iterator iterator() {
064: return inner.iterator();
065: }
066:
067: public boolean remove(Object o) {
068: return inner.remove(o);
069: }
070:
071: public boolean removeAll(Collection c) {
072: return inner.removeAll(c);
073: }
074:
075: public boolean retainAll(Collection c) {
076: return inner.retainAll(c);
077: }
078:
079: public int size() {
080: return inner.size();
081: }
082:
083: public Object[] toArray() {
084: return inner.toArray();
085: }
086:
087: public Object[] toArray(Object[] a) {
088: return inner.toArray(a);
089: }
090:
091: public String toString() {
092: return "Delate to " + inner;
093: }
094:
095: public int hashCode() {
096: return 7 + inner.hashCode();
097: }
098:
099: public boolean equals(Object o) {
100: if (this == o)
101: return true;
102: if (o instanceof CollectionDelegate) {
103: return inner.equals(((CollectionDelegate) o).inner);
104: } else {
105: return false;
106: }
107: }
108: }
|