You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
125 lines
2.7 KiB
125 lines
2.7 KiB
package de.memtext.baseobjects.coll; |
|
|
|
import java.io.Serializable; |
|
import java.util.Collection; |
|
import java.util.Iterator; |
|
import java.util.LinkedList; |
|
|
|
/** |
|
* Basis for the collections, but default the used collection is a |
|
* linkedList, subclasses may change to use a list or set |
|
* @author MB |
|
* */ |
|
public class BaseObjectCollection implements Collection,Serializable { |
|
protected Collection collect; |
|
private static final long serialVersionUID = 1; |
|
public BaseObjectCollection() { |
|
super(); |
|
collect = new LinkedList(); |
|
} |
|
|
|
|
|
|
|
public int size() { |
|
return collect.size(); |
|
} |
|
|
|
/* (non-Javadoc) |
|
* @see java.util.Collection#isEmpty() |
|
*/ |
|
public boolean isEmpty() { |
|
return collect.isEmpty(); |
|
} |
|
|
|
/* (non-Javadoc) |
|
* @see java.util.Collection#contains(java.lang.Object) |
|
*/ |
|
public boolean contains(Object o) { |
|
return collect.contains(o); |
|
} |
|
|
|
/* (non-Javadoc) |
|
* @see java.util.Collection#iterator() |
|
*/ |
|
public Iterator iterator() { |
|
return collect.iterator(); |
|
} |
|
|
|
/* (non-Javadoc) |
|
* @see java.util.Collection#toArray() |
|
*/ |
|
public Object[] toArray() { |
|
return collect.toArray(); |
|
} |
|
|
|
/* (non-Javadoc) |
|
* @see java.util.Collection#toArray(java.lang.Object[]) |
|
*/ |
|
public Object[] toArray(Object[] a) { |
|
return collect.toArray(a); |
|
} |
|
|
|
|
|
|
|
|
|
/* (non-Javadoc) |
|
* @see java.util.Collection#containsAll(java.util.Collection) |
|
*/ |
|
public boolean containsAll(Collection c) { |
|
return collect.containsAll(c); |
|
} |
|
|
|
/* (non-Javadoc) |
|
* @see java.util.Collection#addAll(java.util.Collection) |
|
*/ |
|
public boolean addAll(Collection c) { |
|
return collect.addAll(c); |
|
} |
|
|
|
/* (non-Javadoc) |
|
* @see java.util.Collection#removeAll(java.util.Collection) |
|
*/ |
|
public boolean removeAll(Collection c) { |
|
return collect.removeAll(c); |
|
} |
|
|
|
/* (non-Javadoc) |
|
* @see java.util.Collection#retainAll(java.util.Collection) |
|
*/ |
|
public boolean retainAll(Collection c) { |
|
return collect.retainAll(c); |
|
} |
|
|
|
/* (non-Javadoc) |
|
* @see java.util.Collection#clear() |
|
*/ |
|
public void clear() { |
|
collect.clear(); |
|
} |
|
|
|
/* (non-Javadoc) |
|
* @see java.util.Collection#add(java.lang.Object) |
|
*/ |
|
public boolean add(Object o) { |
|
if (o==null) throw new IllegalArgumentException("can't add null value"); |
|
return collect.add(o); |
|
} |
|
|
|
/* (non-Javadoc) |
|
* @see java.util.Collection#remove(java.lang.Object) |
|
*/ |
|
public boolean remove(Object o) { |
|
return collect.remove(o); |
|
} |
|
|
|
|
|
/** |
|
* Only shallow copy |
|
*/ |
|
protected Object clone() throws CloneNotSupportedException { |
|
BaseObjectCollection c=new BaseObjectCollection(); |
|
c.addAll(this); |
|
return c; |
|
} |
|
} |
|
//Created on 30.1.2004
|