net.moioli.chart.swing
Class CompatibleToCollectionWrapper
java.lang.Object
net.moioli.chart.swing.CompatibleToCollectionWrapper
- All Implemented Interfaces:
- java.lang.Iterable, java.util.Collection
public class CompatibleToCollectionWrapper
- extends java.lang.Object
- implements java.util.Collection
This is just a stupid wrapper around Collection to solve an incompatibility
between the Collection interface and the JPanel class.
Both classes, in facts, have a method named size() that makes impossible for
a class to both derive JPanel and extend Collection.
Since this is needed for JGraph, I created this class that simply renames the
Collection size() method into getCollectionSize() leaving everything else
unchanged. This is what CompatibleCollection basically does.
There's also a companion wrapper that does the opposite to achieve maximum
compatibility.
- Version:
- 2005/10/5
- Author:
- Silvio Moioli
Method Summary |
boolean |
add(java.lang.Object arg0)
|
boolean |
addAll(java.util.Collection arg0)
|
void |
clear()
|
boolean |
contains(java.lang.Object arg0)
|
boolean |
containsAll(java.util.Collection arg0)
|
boolean |
isEmpty()
|
java.util.Iterator |
iterator()
|
boolean |
remove(java.lang.Object arg0)
|
boolean |
removeAll(java.util.Collection arg0)
|
boolean |
retainAll(java.util.Collection arg0)
|
int |
size()
Renames the getCollectionSize() method back to size(), returns the number
of elements in the wrapped Collection. |
java.lang.Object[] |
toArray()
|
java.lang.Object[] |
toArray(java.lang.Object[] arg0)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Collection |
equals, hashCode |
CompatibleToCollectionWrapper
public CompatibleToCollectionWrapper(CompatibleCollection wrapped)
- Standard constructor, wraps a CompatibleCollection.
- Parameters:
wrapped
- the Collection to be wrapped
size
public int size()
- Renames the getCollectionSize() method back to size(), returns the number
of elements in the wrapped Collection.
- Specified by:
size
in interface java.util.Collection
- Returns:
- the number of elements
add
public boolean add(java.lang.Object arg0)
- Specified by:
add
in interface java.util.Collection
- See Also:
Collection.add(Object arg0)
addAll
public boolean addAll(java.util.Collection arg0)
- Specified by:
addAll
in interface java.util.Collection
- See Also:
Collection.addAll(Collection arg0)
clear
public void clear()
- Specified by:
clear
in interface java.util.Collection
- See Also:
Collection.clear()
contains
public boolean contains(java.lang.Object arg0)
- Specified by:
contains
in interface java.util.Collection
- See Also:
Collection.contains(Object arg0)
containsAll
public boolean containsAll(java.util.Collection arg0)
- Specified by:
containsAll
in interface java.util.Collection
- See Also:
Collection.containsAll(Collection arg0)
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interface java.util.Collection
- See Also:
Collection.isEmpty()
iterator
public java.util.Iterator iterator()
- Specified by:
iterator
in interface java.lang.Iterable
- Specified by:
iterator
in interface java.util.Collection
- See Also:
Collection.iterator()
remove
public boolean remove(java.lang.Object arg0)
- Specified by:
remove
in interface java.util.Collection
- See Also:
Collection.remove(Object arg0)
removeAll
public boolean removeAll(java.util.Collection arg0)
- Specified by:
removeAll
in interface java.util.Collection
- See Also:
Collection.removeAll(Collection arg0)
retainAll
public boolean retainAll(java.util.Collection arg0)
- Specified by:
retainAll
in interface java.util.Collection
- See Also:
Collection.retainAll(Collection arg0)
toArray
public java.lang.Object[] toArray()
- Specified by:
toArray
in interface java.util.Collection
- See Also:
Collection.toArray()
toArray
public java.lang.Object[] toArray(java.lang.Object[] arg0)
- Specified by:
toArray
in interface java.util.Collection
- See Also:
Collection.toArray(Object[] arg0)