Class SetSet<T>

    • Constructor Detail

      • SetSet

        public SetSet​(java.util.Set<T> set,
                      java.lang.Class<?> param)
        Creates a new array collection wrapper using the default type registry.
        Parameters:
        set - the set to be wrapped
        param - the only type parameter characterizing
      • SetSet

        public SetSet​(java.util.Set<T> set,
                      java.lang.Class<?> param,
                      TypeRegistry registry)
        Creates a new array collection wrapper.
        Parameters:
        set - the set to be wrapped
        registry - the type registry to use
        param - the only type parameter characterizing
      • SetSet

        public SetSet​(java.util.Set<T> set,
                      TypeDescriptor<?>... params)
        Creates a new set wrapper.
        Parameters:
        set - the set to be wrapped
        params - the type parameter characterizing
    • Method Detail

      • getGenericParameterCount

        public int getGenericParameterCount()
        Description copied from interface: Collection
        Returns the number of generic parameters of T.
        Specified by:
        getGenericParameterCount in interface Collection<T>
        Returns:
        the number of generic parameter
      • getGenericParameterType

        public TypeDescriptor<?> getGenericParameterType​(int index)
        Description copied from interface: Collection
        Returns the type of the specified generic parameter of T.
        Specified by:
        getGenericParameterType in interface Collection<T>
        Parameters:
        index - the 0-based index of the generic parameter
        Returns:
        the actual type of the generic parameter
      • size

        public int size()
        Description copied from interface: Collection
        Returns the number of elements in the underlying collection.
        Specified by:
        size in interface Collection<T>
        Returns:
        the number of elements
      • allowSequenceAdjustment

        public boolean allowSequenceAdjustment()
        Description copied from interface: Collection
        Returns whether a IStringValueProvider may reorder the sequence of this collection for (test) output.
        Specified by:
        allowSequenceAdjustment in interface Collection<T>
        Returns:
        true if a value provider may reorder the sequence, false else
      • iterator

        public java.util.Iterator<T> iterator()
        Description copied from interface: Collection
        Returns an iterator on the individual elements of this collection.
        Specified by:
        iterator in interface Collection<T>
        Specified by:
        iterator in interface java.lang.Iterable<T>
        Returns:
        the iterator
      • isEquals

        public boolean isEquals​(Collection<?> elements)
        Description copied from interface: Collection
        Returns whether this collection is equal to elements. Please note that the actual semantics, i.e., whether the elements must also be in the same sequence, depends on the actual semantics of the collection.
        Specified by:
        isEquals in interface Collection<T>
        Parameters:
        elements - the collection to be tested
        Returns:
        true if both collections are considered to be equal, false else
      • getStringValue

        public java.lang.String getStringValue​(IStringValueProvider.StringComparator comparator)
        Description copied from interface: IStringValueProvider
        Returns the string value of this object.
        Specified by:
        getStringValue in interface IStringValueProvider
        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
      • excluding

        public Set<T> excluding​(Collection<T> set)
        Description copied from interface: Set
        Exclude the elements in set.
        Specified by:
        excluding in interface Set<T>
        Parameters:
        set - the elements to be excluded
        Returns:
        this set without the elements in set
      • including

        public Set<T> including​(Collection<T> set)
        Description copied from interface: Set
        Include the elements in set. Duplicates will not be included.
        Specified by:
        including in interface Set<T>
        Parameters:
        set - the elements to be excluded
        Returns:
        this set without the elements in set
      • union

        public Set<T> union​(Set<T> set)
        Description copied from interface: Set
        Compute the union of this set and set (without duplicates).
        Specified by:
        union in interface Set<T>
        Parameters:
        set - the elements to be unified with this set
        Returns:
        the union of this set and set
      • intersection

        public Set<T> intersection​(Set<T> set)
        Description copied from interface: Set
        Returns the intersection of this set with set.
        Specified by:
        intersection in interface Set<T>
        Parameters:
        set - the elements to be unified with this set
        Returns:
        the intersection of this set and set
      • add

        public T add​(T element)
        Description copied from interface: Set
        Adds an element to this set.
        Specified by:
        add in interface Set<T>
        Parameters:
        element - the element to be added
        Returns:
        element
      • remove

        public boolean remove​(T element)
        Description copied from interface: Set
        Removes the given element from this sequence.
        Specified by:
        remove in interface Set<T>
        Parameters:
        element - the element to be removed
        Returns:
        true of the element was removed, false else
      • selectByType

        public Set<T> selectByType​(TypeDescriptor<?> type)
        Description copied from interface: Collection
        Does type selection of elements (only the same type).
        Specified by:
        selectByType in interface Collection<T>
        Specified by:
        selectByType in interface Set<T>
        Parameters:
        type - the target type
        Returns:
        the selected elements (the type will be adjusted to the actual type for type)
      • selectByKind

        public Set<T> selectByKind​(TypeDescriptor<?> type)
        Description copied from interface: Collection
        Does type selection of elements (including subtypes).
        Specified by:
        selectByKind in interface Collection<T>
        Specified by:
        selectByKind in interface Set<T>
        Parameters:
        type - the target type
        Returns:
        the selected elements (the type will be adjusted to the actual type for type)
      • typeReject

        public Set<T> typeReject​(TypeDescriptor<?> type)
        Description copied from interface: Collection
        Does type selection of elements not having the same type (including subtypes).
        Specified by:
        typeReject in interface Collection<T>
        Specified by:
        typeReject in interface Set<T>
        Parameters:
        type - the target type
        Returns:
        the selected elements (the type will be adjusted to the actual type for type)
      • flatten

        public Set<?> flatten()
                       throws VilException
        Description copied from interface: Collection
        Flattens this collection if needed, i.e., flatten sub-collections.
        Specified by:
        flatten in interface Collection<T>
        Specified by:
        flatten in interface Set<T>
        Returns:
        the flattened collection
        Throws:
        VilException - in case of type incompatibilities
      • select

        public Set<T> select​(ExpressionEvaluator evaluator)
                      throws VilException
        Description copied from interface: Collection
        Selects elements in this collection according to the given expression.
        Specified by:
        select in interface Collection<T>
        Specified by:
        select in interface Set<T>
        Parameters:
        evaluator - the evaluator (results must evaluate to Boolean)
        Returns:
        the selected elements
        Throws:
        VilException - in case that evaluation fails
      • reject

        public Set<T> reject​(ExpressionEvaluator evaluator)
                      throws VilException
        Description copied from interface: Collection
        Rejects elements in this collection according to the given expression.
        Specified by:
        reject in interface Collection<T>
        Specified by:
        reject in interface Set<T>
        Parameters:
        evaluator - the evaluator (results must evaluate to Boolean)
        Returns:
        the rejected elements
        Throws:
        VilException - in case that evaluation fails
      • collect

        public Set<?> collect​(ExpressionEvaluator evaluator)
                       throws VilException
        Description copied from interface: Collection
        Collects the application of evaluator to each individual element and flattens nested structures.
        Specified by:
        collect in interface Collection<T>
        Specified by:
        collect in interface Set<T>
        Parameters:
        evaluator - the evaluator (results must evaluate to Boolean)
        Returns:
        the application results
        Throws:
        VilException - in case that evaluation fails
      • collectNested

        public Set<?> collectNested​(ExpressionEvaluator evaluator)
                             throws VilException
        Description copied from interface: Collection
        Collects the application of evaluator to each individual element and keeps nested structures.
        Specified by:
        collectNested in interface Collection<T>
        Specified by:
        collectNested in interface Set<T>
        Parameters:
        evaluator - the evaluator (results must evaluate to Boolean)
        Returns:
        the application results
        Throws:
        VilException - in case that evaluation fails
      • closure

        public Set<?> closure​(ExpressionEvaluator evaluator)
                       throws VilException
        Description copied from interface: Collection
        Calculates a transitive closure over elements provided by this collection and evaluator.
        Specified by:
        closure in interface Collection<T>
        Specified by:
        closure in interface Set<T>
        Parameters:
        evaluator - the evaluator providing the links/collections to follow
        Returns:
        the closure
        Throws:
        VilException - in case that evaluation fails
      • apply

        public java.lang.Object apply​(ExpressionEvaluator evaluator)
                               throws VilException
        Description copied from interface: Collection
        Processes elements in this set by applying to given expression.
        Specified by:
        apply in interface Collection<T>
        Parameters:
        evaluator - the evaluator holding the iterator / expression to apply
        Returns:
        the aggregated value, null in case of no aggregation
        Throws:
        VilException - in case that selection fails
      • toSequence

        public Sequence<T> toSequence()
        Description copied from interface: Set
        Turns this set into a sequence.
        Specified by:
        toSequence in interface Set<T>
        Returns:
        the set containing the elements of this set
      • asSequence

        public Sequence<T> asSequence()
        Description copied from interface: Collection
        Turns this collection into a sequence.
        Specified by:
        asSequence in interface Collection<T>
        Returns:
        the set containing the elements of this collection
      • asSet

        public Set<T> asSet()
        Description copied from interface: Collection
        Turns this collection into a set.
        Specified by:
        asSet in interface Collection<T>
        Returns:
        the set containing the elements of this collection (excluding duplicates)
      • projectSingle

        public T projectSingle()
        Description copied from interface: Set
        In case that the sequence has exactly one element, this will be returned.
        Specified by:
        projectSingle in interface Set<T>
        Returns:
        the only element or null
      • toMappedSet

        public java.util.Set<T> toMappedSet()
        Description copied from interface: Set
        Converts back to a set for utilizing this with external classes.
        Specified by:
        toMappedSet in interface Set<T>
        Returns:
        the internal map
      • clear

        public void clear()
        Description copied from interface: Collection
        Clears this collection.
        Specified by:
        clear in interface Collection<T>
      • difference

        public Set<T> difference​(Set<T> set)
        Description copied from interface: Set
        Calculates the difference between this and the given set.
        Specified by:
        difference in interface Set<T>
        Parameters:
        set - the set to calculate the difference for
        Returns:
        the set difference
      • symmetricDifference

        public Set<T> symmetricDifference​(Set<T> set)
        Description copied from interface: Set
        Calculates the symmetric difference between this and the given set.
        Specified by:
        symmetricDifference in interface Set<T>
        Parameters:
        set - the set to calculate the difference for
        Returns:
        the symmetric set difference