umontreal.iro.lecuyer.util
Class TransformingList<OE,IE>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<OE>
-
- umontreal.iro.lecuyer.util.TransformingList<OE,IE>
-
- All Implemented Interfaces:
- java.lang.Iterable<OE>, java.util.Collection<OE>, java.util.List<OE>
- Direct Known Subclasses:
- ListWithStat
public abstract class TransformingList<OE,IE> extends java.util.AbstractList<OE>Represents a list that dynamically transforms the elements of another list. This abstract class defines a list containing an inner list 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 provide methods for converting between the inner and the outer types.@param <IE> the inner type of the elements.
-
-
Constructor Summary
Constructors Constructor and Description TransformingList(java.util.List<IE> fromList)Creates a new transforming list wrapping the inner list fromList.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description voidadd(int index, OE element)voidclear()abstract OEconvertFromInnerType(IE e)Converts an element in the inner list to an element of the outer type.abstract IEconvertToInnerType(OE e)Converts an element of the outer type to an element for the inner list.OEget(int index)java.util.List<IE>getInnerList()java.util.Iterator<OE>iterator()java.util.ListIterator<OE>listIterator()java.util.ListIterator<OE>listIterator(int index)OEremove(int index)OEset(int index, OE element)intsize()-
Methods inherited from class java.util.AbstractList
add, addAll, equals, hashCode, indexOf, lastIndexOf, subList
-
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
-
-
-
-
Constructor Detail
-
TransformingList
public TransformingList(java.util.List<IE> fromList)
Creates a new transforming list wrapping the inner list fromList.- Parameters:
fromList- the inner list.
-
-
Method Detail
-
getInnerList
public java.util.List<IE> getInnerList()
-
convertFromInnerType
public abstract OE convertFromInnerType(IE e)
Converts an element in the inner list to an element of the outer type.- Parameters:
e- the inner element.- Returns:
- the outer element.
-
convertToInnerType
public abstract IE convertToInnerType(OE e)
Converts an element of the outer type to an element for the inner list.- Parameters:
e- the outer element.- Returns:
- the inner element.
-
add
public void add(int index, OE element)
-
clear
public void clear()
-
get
public OE get(int index)
-
iterator
public java.util.Iterator<OE> iterator()
-
listIterator
public java.util.ListIterator<OE> listIterator()
-
listIterator
public java.util.ListIterator<OE> listIterator(int index)
-
remove
public OE remove(int index)
-
-
DMelt 3.0 © DataMelt by jWork.ORG