Class AbstractListWrapper<T>
- java.lang.Object
-
- net.ssehub.easy.instantiation.core.model.vilTypes.AbstractCollectionWrapper<T>
-
- net.ssehub.easy.instantiation.core.model.vilTypes.AbstractListWrapper<T>
-
- Type Parameters:
T- the element type
- All Implemented Interfaces:
java.lang.Iterable<T>,Collection<T>,IStringValueProvider,IVilGenericType,IVilType
- Direct Known Subclasses:
ListSequence,ListSet
public abstract class AbstractListWrapper<T> extends AbstractCollectionWrapper<T> implements Collection<T>
Implements an array wrapper for the VIL collection type.- Author:
- Holger Eichelberger
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.ssehub.easy.instantiation.core.model.vilTypes.IStringValueProvider
IStringValueProvider.StringComparator
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<T>listprivate TypeDescriptor<?>[]paramsprivate TypeDescriptor<?>type-
Fields inherited from class net.ssehub.easy.instantiation.core.model.vilTypes.AbstractCollectionWrapper
NUMBER_COMPARATOR
-
-
Constructor Summary
Constructors Constructor Description AbstractListWrapper(java.util.List<T> list, boolean set, TypeDescriptor<?>... params)Creates a new array collection wrapper.AbstractListWrapper(java.util.List<T> list, TypeRegistry registry, boolean set, java.lang.Class<?> param)Creates a new array collection wrapper.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanallowSequenceAdjustment()Returns whether aIStringValueProvidermay reorder the sequence of this collection for (test) output.voidclear()Clears this collection.booleanequals(java.lang.Object object)protected TypeDescriptor<?>[]getGenericParameter()Returns the params for further use.intgetGenericParameterCount()Returns the number of generic parameters ofT.TypeDescriptor<?>getGenericParameterType(int index)Returns the type of the specified generic parameter ofT.protected java.util.List<T>getList()Returns the list for further use.java.lang.StringgetStringValue(IStringValueProvider.StringComparator comparator)Returns the string value of this object.TypeDescriptor<?>getType()Returns the actual type including generics.inthashCode()java.util.Iterator<T>iterator()Returns an iterator on the individual elements of this collection.protected static <T> java.util.List<T>removeDuplicates(java.util.List<T> elements)Removes duplicates from the given list.intsize()Returns the number of elements in the underlying collection.java.util.List<T>toMappedList()Turns the array into a list for mapping to external Java types.java.util.Set<T>toMappedSet()Turns the array into a set for mapping to external Java types.java.lang.StringtoString()-
Methods inherited from class net.ssehub.easy.instantiation.core.model.vilTypes.AbstractCollectionWrapper
aggregate, any, any, append, apply, avg, closure, collect, collect, constructType, containsAll, count, equals, excludes, excludesAll, excluding, exists, exists, flatten, forAll, forAll, getFlattenedParams, includes, includesAll, including, intersection, isAcyclic, isAcyclic, isEmpty, isNotEmpty, isUnique, isUnique, max, min, one, one, product, revertImpl, sameElements, select, select, selectByType, selectByType, sortAlphaImpl, sortImpl, sortImpl, sum, union
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.ssehub.easy.instantiation.core.model.vilTypes.Collection
any, apply, asSequence, asSet, avg, cloneCollection, closure, collect, collectNested, count, excludes, excludesAll, exists, flatten, forAll, includes, includesAll, isAcyclic, isEmpty, isEquals, isNotEmpty, isUnique, max, min, one, product, reject, select, selectByKind, selectByType, sortedBy, sum, typeReject
-
-
-
-
Field Detail
-
list
private java.util.List<T> list
-
type
private TypeDescriptor<?> type
-
params
private TypeDescriptor<?>[] params
-
-
Constructor Detail
-
AbstractListWrapper
public AbstractListWrapper(java.util.List<T> list, TypeRegistry registry, boolean set, java.lang.Class<?> param)
Creates a new array collection wrapper.- Parameters:
list- the wrapped listset- does this type represent a set or a sequenceregistry- the type registry to use for the conversion ofparamparam- the type parameter characterizing
-
AbstractListWrapper
public AbstractListWrapper(java.util.List<T> list, boolean set, TypeDescriptor<?>... params)
Creates a new array collection wrapper.- Parameters:
list- the wrapped listset- does this type represent a set or a sequenceparams- the type parameter characterizing
-
-
Method Detail
-
removeDuplicates
protected static <T> java.util.List<T> removeDuplicates(java.util.List<T> elements)
Removes duplicates from the given list.- Type Parameters:
T- the element type- Parameters:
elements- the elements to remove duplicates from (may be null)- Returns:
- a list of elements without duplicates, may be null if elements is null
-
getList
protected java.util.List<T> getList()
Returns the list for further use.- Returns:
- the list
-
getGenericParameter
protected TypeDescriptor<?>[] getGenericParameter()
Returns the params for further use.- Returns:
- the params
-
iterator
public java.util.Iterator<T> iterator()
Description copied from interface:CollectionReturns an iterator on the individual elements of this collection.- Specified by:
iteratorin interfaceCollection<T>- Specified by:
iteratorin interfacejava.lang.Iterable<T>- Returns:
- the iterator
-
size
public int size()
Description copied from interface:CollectionReturns the number of elements in the underlying collection.- Specified by:
sizein interfaceCollection<T>- Returns:
- the number of elements
-
getGenericParameterCount
public int getGenericParameterCount()
Description copied from interface:CollectionReturns the number of generic parameters ofT.- Specified by:
getGenericParameterCountin interfaceCollection<T>- Returns:
- the number of generic parameter
-
getGenericParameterType
public TypeDescriptor<?> getGenericParameterType(int index)
Description copied from interface:CollectionReturns the type of the specified generic parameter ofT.- Specified by:
getGenericParameterTypein interfaceCollection<T>- Parameters:
index- the 0-based index of the generic parameter- Returns:
- the actual type of the generic parameter
-
getType
public TypeDescriptor<?> getType()
Description copied from interface:IVilGenericTypeReturns the actual type including generics. "Overrides"PseudoAny.getType(Object).- Specified by:
getTypein interfaceIVilGenericType- Returns:
- the actual type
-
getStringValue
public java.lang.String getStringValue(IStringValueProvider.StringComparator comparator)
Description copied from interface:IStringValueProviderReturns the string value of this object.- Specified by:
getStringValuein interfaceIStringValueProvider- Parameters:
comparator- if the sequence of elements, e.g., in case of collections, shall be ordered according to the comparator, null if the original sequence shall be returned- Returns:
- the string value
-
allowSequenceAdjustment
public boolean allowSequenceAdjustment()
Description copied from interface:CollectionReturns whether aIStringValueProvidermay reorder the sequence of this collection for (test) output.- Specified by:
allowSequenceAdjustmentin interfaceCollection<T>- Returns:
trueif a value provider may reorder the sequence,falseelse
-
equals
public boolean equals(java.lang.Object object)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toMappedList
public java.util.List<T> toMappedList()
Turns the array into a list for mapping to external Java types.- Returns:
- the list
-
toMappedSet
public java.util.Set<T> toMappedSet()
Turns the array into a set for mapping to external Java types.- Returns:
- the list
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
clear
public void clear()
Description copied from interface:CollectionClears this collection.- Specified by:
clearin interfaceCollection<T>
-
-