Class AbstractArrayWrapper<T>

    • Constructor Detail

      • AbstractArrayWrapper

        public AbstractArrayWrapper​(T[] array,
                                    TypeRegistry registry,
                                    boolean set,
                                    java.lang.Class<?> param)
        Creates a new array collection wrapper.
        Parameters:
        array - the wrapped array
        set - does this type represent a set or a sequence
        registry - the type registry to use for the conversion of param
        param - the type parameter characterizing
      • AbstractArrayWrapper

        public AbstractArrayWrapper​(T[] array,
                                    boolean set,
                                    TypeDescriptor<?>... params)
        Creates a new array collection wrapper.
        Parameters:
        array - the wrapped array
        set - does this type represent a set or a sequence
        params - the type parameter characterizing
    • Method Detail

      • getArray

        protected T[] getArray()
        Returns the array for further use.
        Returns:
        the array
      • getGenericParameter

        protected TypeDescriptor<?>[] getGenericParameter()
        Returns the generic parameter for further use.
        Returns:
        the generic parameter
      • removeDuplicates

        protected static <T> T[] removeDuplicates​(T[] elements)
        Removes duplicates from the given array.
        Type Parameters:
        T - the element type
        Parameters:
        elements - the elements to remove duplicates from (may be null)
        Returns:
        an array of elements without duplicates, may be null if elements is null
      • 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
      • 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
      • 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
      • 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
      • 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
      • extendCapacity

        protected void extendCapacity​(int increment)
        Extends the capacity by increment.
        Parameters:
        increment - the increment
      • decreaseCapacity

        protected void decreaseCapacity​(int decrement)
        Decreases the capacity.
        Parameters:
        decrement - the decrement for decreasing the capacity
      • equals

        public boolean equals​(java.lang.Object object)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.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
      • remove

        public boolean remove​(T element)
        Removes the first occurrence of the given element from this sequence.
        Parameters:
        element - the element to be removed
        Returns:
        true of the element was removed, false else
      • removeAll

        public void removeAll​(T element)
        Removes all elements equal to element. (QVT)
        Parameters:
        element - the element to remove all copies for
      • removeAt

        public T removeAt​(int index)
        Removes the element at index. (QVT)
        Parameters:
        index - the index of the element to remove
        Returns:
        the removed index, undefined if index is not valid
      • removeAtImpl

        private T removeAtImpl​(int index)
        Removes the element at index. (QVT)
        Parameters:
        index - the 0-based index of the element to remove
        Returns:
        the removed index, undefined if index is not valid
      • removeFirst

        public T removeFirst()
        Removes the first element. (QVT)
        Returns:
        the removed element, undefined if there is no first element
      • removeLast

        public T removeLast()
        Removes the last element. (QVT)
        Returns:
        the removed element, undefined if there is no last element
      • clear

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