Class KeyCollectionImpl.BuilderImpl<E>

    • Field Detail

      • allowNullElem

        boolean allowNullElem
      • constraint

        java.util.function.Predicate<E> constraint
      • beforeInsertTrigger

        java.util.function.Consumer<E> beforeInsertTrigger
      • afterInsertTrigger

        java.util.function.Consumer<E> afterInsertTrigger
      • beforeDeleteTrigger

        java.util.function.Consumer<E> beforeDeleteTrigger
      • afterDeleteTrigger

        java.util.function.Consumer<E> afterDeleteTrigger
      • collection

        java.util.Collection<? extends E> collection
      • array

        E[] array
      • capacity

        int capacity
      • maxSize

        int maxSize
      • movingWindow

        java.lang.Boolean movingWindow
      • setBehavior

        boolean setBehavior
        True to specify that the collection behaves like a Set on adding elements, i.e. if an element cannot be added due to duplicate or other constraints, no exception is thrown.
      • count

        boolean count
        True to count only number of occurrences of equal elements
      • useBigList

        boolean useBigList
        True to store list data in a BigList instance, false for a GapList instance (only used for KeyList, Key1List, Key2List)
    • Constructor Detail

      • BuilderImpl

        public BuilderImpl()
    • Method Detail

      • withNull

        protected KeyCollectionImpl.BuilderImpl<E> withNull​(boolean allowNull)
        Specifies whether null elements are allowed or not. A null element will have null keys. This method does not implicitly create an element set, where as withElemNull(boolean) does.
        Parameters:
        allowNull - true to allow null elements (default), false to disallow
        Returns:
        this (fluent interfaces)
      • withConstraint

        protected KeyCollectionImpl.BuilderImpl<E> withConstraint​(java.util.function.Predicate<E> constraint)
        Specify element constraint.
        Parameters:
        constraint - constraint element must satisfy, null for none (default)
        Returns:
        this (fluent interface)
      • withBeforeInsertTrigger

        protected KeyCollectionImpl.BuilderImpl<E> withBeforeInsertTrigger​(java.util.function.Consumer<E> trigger)
        Specify insert trigger.
        Parameters:
        trigger - insert trigger method, null for none (default)
        Returns:
        this (fluent interface)
      • withAfterInsertTrigger

        protected KeyCollectionImpl.BuilderImpl<E> withAfterInsertTrigger​(java.util.function.Consumer<E> trigger)
        Specify insert trigger.
        Parameters:
        trigger - insert trigger method, null for none (default)
        Returns:
        this (fluent interface)
      • withBeforeDeleteTrigger

        protected KeyCollectionImpl.BuilderImpl<E> withBeforeDeleteTrigger​(java.util.function.Consumer<E> trigger)
        Specify delete trigger.
        Parameters:
        trigger - delete trigger method, null for none (default)
        Returns:
        this (fluent interface)
      • withAfterDeleteTrigger

        protected KeyCollectionImpl.BuilderImpl<E> withAfterDeleteTrigger​(java.util.function.Consumer<E> trigger)
        Specify delete trigger.
        Parameters:
        trigger - delete trigger method, null for none (default)
        Returns:
        this (fluent interface)
      • withCapacity

        protected KeyCollectionImpl.BuilderImpl<E> withCapacity​(int capacity)
        Specify initial capacity.
        Parameters:
        capacity - initial capacity
        Returns:
        this (fluent interface)
      • withContent

        protected KeyCollectionImpl.BuilderImpl<E> withContent​(java.util.Collection<? extends E> elements)
        Specify elements added to the collection upon creation.
        Parameters:
        elements - initial elements
        Returns:
        this (fluent interface)
      • withContent

        protected KeyCollectionImpl.BuilderImpl<E> withContent​(E... elements)
        Specify elements added to the collection upon creation.
        Parameters:
        elements - initial elements
        Returns:
        this (fluent interface)
      • withMaxSize

        protected KeyCollectionImpl.BuilderImpl<E> withMaxSize​(int maxSize)
        Specify maximum size of collection. If an attempt is made to add more elements, an exception is thrown.
        Parameters:
        maxSize - maximum size
        Returns:
        this (fluent interface)
      • withWindowSize

        protected KeyCollectionImpl.BuilderImpl<E> withWindowSize​(int maxSize)
        Specify maximum window size of collection. If an attempt is made to add and additional element, the first element is removed.
        Parameters:
        maxSize - maximum window size
        Returns:
        this (fluent interface)
      • withSetBehavior

        protected KeyCollectionImpl.BuilderImpl<E> withSetBehavior​(boolean setBehavior)
        Specifies that the collection behaves like a Set on adding elements, i.e. if an element cannot be added due to duplicate or other constraints, no exception is thrown.
        Parameters:
        setBehavior - true to define set behavior (default is false)
        Returns:
        this (fluent interface)
      • withElemCount

        protected KeyCollectionImpl.BuilderImpl<E> withElemCount​(boolean count)
        Specifies that the collection only counts the number of occurrences of equal elements, but does not store the elements themselves.
        Parameters:
        count - true to count only number of occurrences (default is false)
        Returns:
        this (fluent interface)
      • withOrderByElem

        protected KeyCollectionImpl.BuilderImpl<E> withOrderByElem​(boolean orderBy)
        Specifies that the collection will have the order of the element set. The element set must be sorted, if no sort order has been defined, the natural comparator will be used. If the set allows null values, the used comparator will sort them last.
        Parameters:
        orderBy - if true the collection will have the order of the element set (default is false, only one key map or the element set can have the order by option set)
        Returns:
        this (fluent interface)
      • withOrderByElem

        protected KeyCollectionImpl.BuilderImpl<E> withOrderByElem​(java.lang.Class<?> type)
        Specifies that the list will have the order of the element set. The set will store values of the primitive type specified like int. The set will be sorted using the natural comparator and no null values are allowed.
        Parameters:
        type - primitive type to use for key map (only one key map or the element set can have the order by option set)
        Returns:
        this (fluent interface)
      • withElemNull

        protected KeyCollectionImpl.BuilderImpl<E> withElemNull​(boolean allowNull)
        Specifies whether null elements are allowed or not. A null element will have null keys. This method does implicitly create an element set, where as withNull(boolean) does not.
        Parameters:
        allowNull - true to allow null elements, false to disallow (default is true)
        Returns:
        this (fluent interfaces)
      • withElemDuplicates

        protected KeyCollectionImpl.BuilderImpl<E> withElemDuplicates​(boolean allowDuplicates)
        Specify whether duplicates are allowed or not. This method does implicitly create an element set.
        Parameters:
        allowDuplicates - true to allow duplicates (default is true)
        Returns:
        this (fluent interfaces)
      • withElemDuplicates

        protected KeyCollectionImpl.BuilderImpl<E> withElemDuplicates​(boolean allowDuplicates,
                                                                      boolean allowDuplicatesNull)
        Specify whether duplicates are allowed or not. This method does implicitly create an element set.
        Parameters:
        allowDuplicates - true to allow duplicates (default is true)
        allowDuplicatesNull - true to allow duplicate null values (default is true)
        Returns:
        this (fluent interfaces)
      • withElemSort

        protected KeyCollectionImpl.BuilderImpl<E> withElemSort​(boolean sort)
        Specify that the element set should be sorted using the natural comparator. If the collection supports null values, they are sorted last. This method does implicitly create an element set. Note that this does not automatically sort the collection itself, call a withOrderBy method for this.
        Parameters:
        sort - true to sorted, false for unsorted (default is false)
        Returns:
        this (fluent interface)
      • withElemSort

        protected KeyCollectionImpl.BuilderImpl<E> withElemSort​(java.util.Comparator<? super E> comparator)
        Set comparator to use for sorting the element set. If the collection allows null values, the comparator must be able to compare null values. If the comparator does not support null values, use withElemSort(Comparator, boolean) to explicitly specify how null values should be sorted. This method does implicitly create an element set. Note that this does not automatically sort the collection itself, call a withOrderBy method for this.
        Parameters:
        comparator - comparator to use for sorting (null for natural comparator)
        Returns:
        this (fluent interface)
      • withElemSort

        protected KeyCollectionImpl.BuilderImpl<E> withElemSort​(java.util.Comparator<? super E> comparator,
                                                                boolean sortNullsFirst)
        Set comparator to use for sorting the element set. This method should be used if the collection can contain null values, but the comparator is not able to handle them. The parameter sortNullsFirst determine how the null values should be sorted. This method does implicitly create an element set.
        Parameters:
        comparator - comparator to use for sorting
        sortNullsFirst - true to sort null values first, false for last
        Returns:
        this (fluent interface)
      • withPrimaryElem

        protected KeyCollectionImpl.BuilderImpl<E> withPrimaryElem()
        Specify the element to be a primary key. This is identical to calling withElemNull(false) and withElemDuplicates(false).
        Returns:
        this (fluent interface)
      • withUniqueElem

        protected KeyCollectionImpl.BuilderImpl<E> withUniqueElem()
        Specify the element to be a unique key. This is identical to calling withElemNull(true) and withElemDuplicates(false, true).
        Returns:
        this (fluent interface)
      • withListType

        protected KeyCollectionImpl.BuilderImpl<E> withListType​(java.lang.Class<?> type)
        Specifies that the list will store its elements as primitive type.
        Parameters:
        type - primitive type to use for list
        Returns:
        this (fluent interface)
      • withListBig

        protected KeyCollectionImpl.BuilderImpl<E> withListBig​(boolean big)
        Specify whether list should be stored in an instance of BigList or GapList.
        Parameters:
        big - true to store list content in an instance of BigList, false for GapList
        Returns:
        this (fluent interface)
      • withKeyDuplicates

        protected KeyCollectionImpl.BuilderImpl<E> withKeyDuplicates​(int keyIndex,
                                                                     boolean allowDuplicates,
                                                                     boolean allowDuplicatesNull)
      • withKeySort

        protected KeyCollectionImpl.BuilderImpl<E> withKeySort​(int keyIndex,
                                                               java.util.Comparator<?> comparator,
                                                               boolean sortNullsFirst)
      • withOrderByKey1

        protected KeyCollectionImpl.BuilderImpl<E> withOrderByKey1​(boolean orderBy)
        Specifies that the collection will have the order of the key map. The key map must be sorted, if no sort order has been defined, the natural comparator will be used. If the map allows null values, the used comparator will sort them last.
        Parameters:
        orderBy - if true the collection will have the order of the key map (default is false, only one key map or the element set can have the order by option set)
        Returns:
        this (fluent interface)
      • withOrderByKey1

        protected KeyCollectionImpl.BuilderImpl<E> withOrderByKey1​(java.lang.Class<?> type)
        Specifies that the list will have the order of the key map. The key map will store values of the primitive type specified like int. The key map will be sorted using the natural comparator and no null values are allowed.
        Parameters:
        type - primitive type to use for key map (only one key map or the element set can have the order by option set)
        Returns:
        this (fluent interface)
      • withKey1Null

        protected KeyCollectionImpl.BuilderImpl<E> withKey1Null​(boolean allowNull)
        Specify whether null elements are allowed or not. A null element will have a null key.
        Parameters:
        allowNull - true to allow null elements, false to disallow
        Returns:
        this (fluent interfaces)
      • withKey1Duplicates

        protected KeyCollectionImpl.BuilderImpl<E> withKey1Duplicates​(boolean allowDuplicates)
        Specify whether duplicates are allowed or not.
        Parameters:
        allowDuplicates - true to allow duplicates
        Returns:
        this (fluent interfaces)
      • withKey1Duplicates

        protected KeyCollectionImpl.BuilderImpl<E> withKey1Duplicates​(boolean allowDuplicates,
                                                                      boolean allowDuplicatesNull)
        Specify whether duplicates are allowed or not.
        Parameters:
        allowDuplicates - true to allow duplicates
        allowDuplicatesNull - true to allow duplicate null values
        Returns:
        this (fluent interfaces)
      • withKey1Sort

        protected KeyCollectionImpl.BuilderImpl<E> withKey1Sort​(boolean sort)
        Set comparator to use for sorting the key map. Note that this does not automatically sort the list itself, call a withOrderBy method for this.
        Parameters:
        sort - true to sort key map
        Returns:
        this (fluent interface)
      • withOrderByKey2

        protected KeyCollectionImpl.BuilderImpl<E> withOrderByKey2​(boolean orderBy)
        Specifies that the collection will have the order of the key map. The key map must be sorted, if no sort order has been defined, the natural comparator will be used. If the map allows null values, the used comparator will sort them last.
        Parameters:
        orderBy - if true the collection will have the order of the key map (default is false, only one key map or the element set can have the order by option set)
        Returns:
        this (fluent interface)
      • withOrderByKey2

        protected KeyCollectionImpl.BuilderImpl<E> withOrderByKey2​(java.lang.Class<?> type)
        Specifies that the list will have the order of the key map. The key map will store values of the primitive type specified like int. The key map will be sorted using the natural comparator and no null values are allowed.
        Parameters:
        type - primitive type to use for key map (only one key map or the element set can have the order by option set)
        Returns:
        this (fluent interface)
      • withKey2Null

        protected KeyCollectionImpl.BuilderImpl<E> withKey2Null​(boolean allowNull)
        Specify whether null elements are allowed or not. A null element will have a null key.
        Parameters:
        allowNull - true to allow null elements, false to disallow
        Returns:
        this (fluent interfaces)
      • withKey2Duplicates

        protected KeyCollectionImpl.BuilderImpl<E> withKey2Duplicates​(boolean allowDuplicates)
        Specify whether duplicates are allowed or not.
        Parameters:
        allowDuplicates - true to allow duplicates
        Returns:
        this (fluent interfaces)
      • withKey2Duplicates

        protected KeyCollectionImpl.BuilderImpl<E> withKey2Duplicates​(boolean allowDuplicates,
                                                                      boolean allowDuplicatesNull)
        Specify whether duplicates are allowed or not.
        Parameters:
        allowDuplicates - true to allow duplicates
        allowDuplicatesNull - true to allow duplicate null values
        Returns:
        this (fluent interfaces)
      • withKey2Sort

        protected KeyCollectionImpl.BuilderImpl<E> withKey2Sort​(boolean sort)
        Set comparator to use for sorting the key map. Note that this does not automatically sort the list itself, call a withOrderBy method for this.
        Parameters:
        sort - true to sort key map
        Returns:
        this (fluent interface)
      • initKeyMapBuilder

        void initKeyMapBuilder​(int numKeys)
        Parameters:
        numKeys - number of keys
      • hasElemMapBuilder

        boolean hasElemMapBuilder()
      • isTrue

        boolean isTrue​(java.lang.Boolean b)
      • isFalse

        boolean isFalse​(java.lang.Boolean b)
      • build

        void build​(KeyCollectionImpl keyColl,
                   boolean list)
        Initialize KeyCollectionImpl.
        Parameters:
        keyColl - collection to initialize
        list - true if a KeyListImpl is built up, false for KeyCollectionImpl
      • init

        void init​(KeyCollectionImpl keyColl)
        This method is called if a KeyCollection, Key1Collection, Key2Collection is initialized.
        Parameters:
        keyColl - KeyCollectionImpl which has already been initialized
      • init

        void init​(KeyCollectionImpl keyColl,
                  KeyListImpl keyList)
        This method is called if a KeyList, Key1List, Key2List is initialized.
        Parameters:
        keyColl - KeyCollectionImpl which has already been initialized
        keyList - KeyListImpl to initialize
      • initList

        IList<?> initList()