Interface Set<T>
-
- Type Parameters:
T- the element type
- All Superinterfaces:
Collection<T>,IStringValueProvider,java.lang.Iterable<T>,IVilGenericType,IVilType
- All Known Implementing Classes:
ArraySet,FixedListSet,ListSet,OtherProjects,SetSet,UnmodifiableSet
public interface Set<T> extends Collection<T>
Defines the interface representing a set. The iterator is an internal type which is not registered in theTypeRegistry. Please note that iterator with one type parameter will be represented by the iterator itself, iterators over multiple types by an iterator over an object array of instances which can be cast into the given types. This interface andSequenceshall not be applied together in one class!- 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 static java.util.Set<?>DEFAULT
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Tadd(T element)Adds an element to this set.Set<T>cloneCollection()Clones this collection.Set<?>closure(ExpressionEvaluator evaluator)Calculates a transitive closure over elements provided by this collection andevaluator.Set<?>collect(ExpressionEvaluator evaluator)Collects the application ofevaluatorto each individual element and flattens nested structures.Set<?>collectNested(ExpressionEvaluator evaluator)Collects the application ofevaluatorto each individual element and keeps nested structures.Set<T>difference(Set<T> set)Calculates the difference between this and the given set.Set<T>excluding(Collection<T> set)Exclude the elements inset.Set<?>flatten()Flattens this collection if needed, i.e., flatten sub-collections.Set<T>including(Collection<T> set)Include the elements inset.Set<T>intersection(Set<T> set)Returns the intersection of this set withset.TprojectSingle()In case that the sequence has exactly one element, this will be returned.Set<T>reject(ExpressionEvaluator evaluator)Rejects elements in this collection according to the given expression.booleanremove(T element)Removes the given element from this sequence.Set<T>select(ExpressionEvaluator evaluator)Selects elements in this collection according to the given expression.Set<T>selectByKind(TypeDescriptor<?> type)Does type selection of elements (including subtypes).Set<T>selectByType(TypeDescriptor<?> type)Does type selection of elements (only the same type).Set<T>symmetricDifference(Set<T> set)Calculates the symmetric difference between this and the given set.java.util.Set<T>toMappedSet()Converts back to a set for utilizing this with external classes.Sequence<T>toSequence()Turns this set into a sequence.Set<T>typeReject(TypeDescriptor<?> type)Does type selection of elements not having the same type (including subtypes).Set<T>union(Set<T> set)Compute the union of this set andset(without duplicates).-
Methods inherited from interface net.ssehub.easy.instantiation.core.model.vilTypes.Collection
allowSequenceAdjustment, any, apply, asSequence, asSet, avg, clear, count, excludes, excludesAll, exists, forAll, getGenericParameterCount, getGenericParameterType, includes, includesAll, isAcyclic, isEmpty, isEquals, isNotEmpty, isUnique, iterator, max, min, one, product, size, sortedBy, sum
-
Methods inherited from interface net.ssehub.easy.instantiation.core.model.vilTypes.IStringValueProvider
getStringValue
-
Methods inherited from interface net.ssehub.easy.instantiation.core.model.vilTypes.IVilGenericType
getType
-
-
-
-
Method Detail
-
selectByType
Set<T> selectByType(TypeDescriptor<?> type)
Description copied from interface:CollectionDoes type selection of elements (only the same type).- Specified by:
selectByTypein interfaceCollection<T>- Parameters:
type- the target type- Returns:
- the selected elements (the type will be adjusted to the actual
type for
type)
-
selectByKind
Set<T> selectByKind(TypeDescriptor<?> type)
Description copied from interface:CollectionDoes type selection of elements (including subtypes).- Specified by:
selectByKindin interfaceCollection<T>- Parameters:
type- the target type- Returns:
- the selected elements (the type will be adjusted to the actual
type for
type)
-
typeReject
Set<T> typeReject(TypeDescriptor<?> type)
Description copied from interface:CollectionDoes type selection of elements not having the same type (including subtypes).- Specified by:
typeRejectin interfaceCollection<T>- Parameters:
type- the target type- Returns:
- the selected elements (the type will be adjusted to the actual
type for
type)
-
excluding
Set<T> excluding(Collection<T> set)
Exclude the elements inset.- Parameters:
set- the elements to be excluded- Returns:
- this set without the elements in
set
-
including
Set<T> including(Collection<T> set)
Include the elements inset. Duplicates will not be included.- Parameters:
set- the elements to be excluded- Returns:
- this set without the elements in
set
-
union
Set<T> union(Set<T> set)
Compute the union of this set andset(without duplicates).- Parameters:
set- the elements to be unified with this set- Returns:
- the union of this set and
set
-
intersection
Set<T> intersection(Set<T> set)
Returns the intersection of this set withset.- Parameters:
set- the elements to be unified with this set- Returns:
- the intersection of this set and
set
-
add
T add(T element)
Adds an element to this set.- Parameters:
element- the element to be added- Returns:
element
-
remove
boolean remove(T element)
Removes the given element from this sequence.- Parameters:
element- the element to be removed- Returns:
trueof the element was removed,falseelse
-
select
Set<T> select(ExpressionEvaluator evaluator) throws VilException
Description copied from interface:CollectionSelects elements in this collection according to the given expression.- Specified by:
selectin interfaceCollection<T>- Parameters:
evaluator- the evaluator (results must evaluate to Boolean)- Returns:
- the selected elements
- Throws:
VilException- in case that evaluation fails
-
reject
Set<T> reject(ExpressionEvaluator evaluator) throws VilException
Description copied from interface:CollectionRejects elements in this collection according to the given expression.- Specified by:
rejectin interfaceCollection<T>- Parameters:
evaluator- the evaluator (results must evaluate to Boolean)- Returns:
- the rejected elements
- Throws:
VilException- in case that evaluation fails
-
closure
Set<?> closure(ExpressionEvaluator evaluator) throws VilException
Description copied from interface:CollectionCalculates a transitive closure over elements provided by this collection andevaluator.- Specified by:
closurein interfaceCollection<T>- Parameters:
evaluator- the evaluator providing the links/collections to follow- Returns:
- the closure
- Throws:
VilException- in case that evaluation fails
-
collect
Set<?> collect(ExpressionEvaluator evaluator) throws VilException
Description copied from interface:CollectionCollects the application ofevaluatorto each individual element and flattens nested structures.- Specified by:
collectin interfaceCollection<T>- Parameters:
evaluator- the evaluator (results must evaluate to Boolean)- Returns:
- the application results
- Throws:
VilException- in case that evaluation fails
-
collectNested
Set<?> collectNested(ExpressionEvaluator evaluator) throws VilException
Description copied from interface:CollectionCollects the application ofevaluatorto each individual element and keeps nested structures.- Specified by:
collectNestedin interfaceCollection<T>- Parameters:
evaluator- the evaluator (results must evaluate to Boolean)- Returns:
- the application results
- Throws:
VilException- in case that evaluation fails
-
toSequence
Sequence<T> toSequence()
Turns this set into a sequence.- Returns:
- the set containing the elements of this set
-
projectSingle
T projectSingle()
In case that the sequence has exactly one element, this will be returned.- Returns:
- the only element or null
-
toMappedSet
java.util.Set<T> toMappedSet()
Converts back to a set for utilizing this with external classes.- Returns:
- the internal map
-
flatten
Set<?> flatten() throws VilException
Description copied from interface:CollectionFlattens this collection if needed, i.e., flatten sub-collections.- Specified by:
flattenin interfaceCollection<T>- Returns:
- the flattened collection
- Throws:
VilException- in case of type incompatibilities
-
difference
Set<T> difference(Set<T> set)
Calculates the difference between this and the given set.- Parameters:
set- the set to calculate the difference for- Returns:
- the set difference
-
symmetricDifference
Set<T> symmetricDifference(Set<T> set)
Calculates the symmetric difference between this and the given set.- Parameters:
set- the set to calculate the difference for- Returns:
- the symmetric set difference
-
cloneCollection
Set<T> cloneCollection()
Description copied from interface:CollectionClones this collection. (QVT)- Specified by:
cloneCollectionin interfaceCollection<T>- Returns:
- a clone of this collection
-
-