|
ContactCenters V. 0.9.9. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection<OE>
umontreal.iro.lecuyer.collections.TransformingCollection<OE,IE>
OE
- the outer type of the elements.IE
- the inner type of the elements.public abstract class TransformingCollection<OE,IE>
Represents a collection that dynamically transforms the elements of another
collection. This abstract class defines a collection containing an inner
collection of elements of a certain type, and provides facilities to convert
these inner elements to outer elements of another type. A concrete subclass
simply needs to implement the convertFromInnerType(IE)
and
convertToInnerType(OE)
methods for converting between the inner and the
outer types.
It is strongly recommended that the mapping established by the conversion methods be one-to-one, i.e., an element in the inner collection corresponds to a single element in the outer collection. Otherwise, the size of the outer collection might be incorrect, and the iterator may unexpectedly give the same elements multiple times. Also, null should always correspond to null.
Constructor Summary | |
---|---|
TransformingCollection(Collection<IE> innerCollection)
Constructs a new transforming collection mapping the elements of the inner collection innerCollection. |
Method Summary | |
---|---|
boolean |
add(OE o)
|
void |
clear()
|
boolean |
contains(Object o)
|
abstract OE |
convertFromInnerType(IE e)
Converts an element in the inner collection to an element of the outer type. |
abstract IE |
convertToInnerType(OE e)
Converts an element of the outer type to an element of the inner collection. |
Collection<IE> |
getInnerCollection()
Returns the inner collection. |
boolean |
isEmpty()
|
Iterator<OE> |
iterator()
|
boolean |
remove(Object o)
|
int |
size()
|
Methods inherited from class java.util.AbstractCollection |
---|
addAll, containsAll, removeAll, retainAll, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Collection |
---|
equals, hashCode |
Constructor Detail |
---|
public TransformingCollection(Collection<IE> innerCollection)
innerCollection
- the inner collection.
NullPointerException
- if innerCollection is null.Method Detail |
---|
public Collection<IE> getInnerCollection()
public abstract OE convertFromInnerType(IE e)
e
- the inner element.
public abstract IE convertToInnerType(OE e)
e
- the outer element.
public Iterator<OE> iterator()
iterator
in interface Iterable<OE>
iterator
in interface Collection<OE>
iterator
in class AbstractCollection<OE>
public int size()
size
in interface Collection<OE>
size
in class AbstractCollection<OE>
public boolean add(OE o)
add
in interface Collection<OE>
add
in class AbstractCollection<OE>
public void clear()
clear
in interface Collection<OE>
clear
in class AbstractCollection<OE>
public boolean contains(Object o)
contains
in interface Collection<OE>
contains
in class AbstractCollection<OE>
public boolean isEmpty()
isEmpty
in interface Collection<OE>
isEmpty
in class AbstractCollection<OE>
public boolean remove(Object o)
remove
in interface Collection<OE>
remove
in class AbstractCollection<OE>
|
ContactCenters V. 0.9.9. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |