Class AssemblingUtils


  • public class AssemblingUtils
    extends java.lang.Object
    Helper methods for assembling lists of KeyValue.
    Since:
    4.1.0
    • Constructor Summary

      Constructors 
      Constructor Description
      AssemblingUtils()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean areAllKVsIdentical​(KeyValue verglKeyValue, java.util.List<java.util.List<KeyValue>> pListOfKeyValuesList, java.util.List<java.lang.String> pCriteria)
      Check if the value of verglKeyValue occurs in every list where is a key from verglKeyValue.
      java.util.List<java.lang.String> checkCriteria​(java.util.List<java.lang.String> curCriteria, java.util.List<java.lang.String> defaultCriteria)
      Check if the parameter holds the correct criteria-values.
      int[] countValuesForVerglKey​(KeyValue pCompKeyValue, java.util.List<java.util.List<KeyValue>> pListOfKeyValuesList, java.util.List<java.lang.String> compareCriteria, int[][] arrToRemember)
      Go throw all unhandled KV's of pListOfKeyValuesList and simply look for the amount of occurrence of a unhandled KV with the same key as from pCompKeyValue.
      java.util.List<java.util.List<KeyValue>> deleteIntersectionKVs​(java.util.List<java.util.List<KeyValue>> pListOfKeyValuesList, java.util.List<java.lang.String> compareCriteria)
      If there is one KV's in all lists, they will be deleted in all lists.
      java.util.List<java.util.List<KeyValue>> deleteIntersectionKVsWithMissingKey​(java.util.List<java.util.List<KeyValue>> pListOfKeyValuesList, java.util.List<java.lang.String> compareCriteria)
      If the actual KV was found in every other list (where the key exist in that list) but there is also at least one list without that key.
      java.util.List<java.util.List<KeyValue>> deleteKVsWhereInMoreLists​(java.util.List<java.util.List<KeyValue>> pListOfKeyValuesList, java.util.List<java.lang.String> compareCriteria, int[][] arrToRemember)
      If there is one KV's in at least one more lists, they will be deleted in all this lists.
      int getAmountOfAktKeyInAktList​(KeyValue verglKeyValue, java.util.List<KeyValue> curKeyValueList, java.util.List<java.lang.String> pCriteria)
      Counts in curKeyValueList the amount of Keys of verglKeyValue.
      int[] getAmountOfAktKeyInAllLists​(KeyValue verglKeyValue, java.util.List<java.util.List<KeyValue>> pListOfKeyValuesList, java.util.List<java.lang.String> pCriteria, int[][] arrToRemember, boolean pBreakCondition)
      Counts the amount of Keys of verglKeyValue in ALL lists.
      int[] getIDsOfIntersectionWithMissingKey​(KeyValue pCompKeyValue, java.util.List<java.util.List<KeyValue>> pListOfKeyValuesList, java.util.List<java.lang.String> compareCriteria, int pIndexOfAktList, int pPosInAktList)
      Look in pListOfKeyValuesList where to find the current key value in other lists and write the indexes of the found KV in an array to give them back.
      Here also is indicated if the Key of that current key value is NOT found in a list.
      int[] getIDsOfIntersectionWithMissingKey_UH​(KeyValue pCompKeyValue, java.util.List<java.util.List<KeyValue>> pListOfKeyValuesList, java.util.List<java.lang.String> compareCriteria, int pIndexOfAktList, int pPosInAktList, int[][] arrToRemember)
      Look in pListOfKeyValuesList for all unhandled KV's where to find the current key value in other lists and write the indexes of the found KV in an array to give them back.
      Here also is indicated if the Key of that current key value is NOT found in a list.
      KeyValue getNextVerglKV​(KeyValue verglKeyValue, java.util.List<KeyValue> curKeyValueList, java.util.List<java.lang.String> compareCriteria, int[][] arrToRemember, int curIndex, int[] arrToHoldIDs)
      Search for the next unhandled KV with the same key out of curKeyValueList and his index.
      boolean isAmountOfAktKeyGreaterOne​(KeyValue verglKeyValue, java.util.List<java.util.List<KeyValue>> pListOfKeyValuesList, java.util.List<java.lang.String> pCriteria, int[][] arrToRemember)
      Check if the key of verglKeyValue occurs more then once in at least one listOfList.
      boolean isAnotherKV​(KeyValue curKeyValue, java.util.List<KeyValue> unionArrListKeyValue, java.util.List<java.lang.String> criteria)
      Look if curKeyValue is not jet found in any list depending on the criteria.
      boolean isNoMoreKVInOtherLists​(KeyValue pOriKeyValue, java.util.List<KeyValue> pFoundArrListKeyValue, java.util.List<java.util.List<KeyValue>> pListOfKeyValuesList, java.util.List<java.lang.String> compareCriteria)
      Look in pListOfKeyValuesList if there is an value of the key of pOriKeyValue which is not in pFoundArrListKeyValue.
      This means intersection of all values of the key from pOriKeyValue is not allowed.
      int[][] markAktKeyAsHandeled​(KeyValue pCompKeyValue, java.util.List<java.util.List<KeyValue>> pListOfKeyValuesList, java.util.List<java.lang.String> compareCriteria, int[][] arrToRemember)
      Go throw all unhandled KV's pListOfKeyValuesList and mark all KV's which have the same key as verglKeyValue as handled.
      int[][] markAsHandeled​(int[][] arrToRemember, KeyValue verglKeyValue, java.util.List<java.util.List<KeyValue>> pListOfKeyValuesList, java.util.List<java.lang.String> pCriteria, int pFrom)
      Every KV which is identical with KV of verglKeyValue will be marked as handled.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AssemblingUtils

        public AssemblingUtils()
    • Method Detail

      • deleteIntersectionKVs

        public java.util.List<java.util.List<KeyValue>> deleteIntersectionKVs​(java.util.List<java.util.List<KeyValue>> pListOfKeyValuesList,
                                                                              java.util.List<java.lang.String> compareCriteria)
                                                                       throws PubServerException
        If there is one KV's in all lists, they will be deleted in all lists.
        Parameters:
        pListOfKeyValuesList - The list of key value lists where double entries will be deleted.
        compareCriteria - The actual compare criteria to be able to decide when one KV is identical.
        Returns:
        The reduced pListOfKeyValuesList.
        Throws:
        PubServerException
        Since:
        4.1.0
      • deleteKVsWhereInMoreLists

        public java.util.List<java.util.List<KeyValue>> deleteKVsWhereInMoreLists​(java.util.List<java.util.List<KeyValue>> pListOfKeyValuesList,
                                                                                  java.util.List<java.lang.String> compareCriteria,
                                                                                  int[][] arrToRemember)
                                                                           throws PubServerException
        If there is one KV's in at least one more lists, they will be deleted in all this lists.
        Parameters:
        pListOfKeyValuesList - The list of key value lists where double entries will be deleted.
        compareCriteria - The actual compare criteria to be able to decide when one KV is identical.
        Returns:
        The reduced pListOfKeyValuesList.
        Throws:
        PubServerException
        Since:
        4.1.0
      • deleteIntersectionKVsWithMissingKey

        public java.util.List<java.util.List<KeyValue>> deleteIntersectionKVsWithMissingKey​(java.util.List<java.util.List<KeyValue>> pListOfKeyValuesList,
                                                                                            java.util.List<java.lang.String> compareCriteria)
                                                                                     throws PubServerException
        If the actual KV was found in every other list (where the key exist in that list) but there is also at least one list without that key.
        Parameters:
        pListOfKeyValuesList - The list of key value lists where entries may may be deleted.
        compareCriteria - List of elements those who will be checked for equality.
        Returns:
        The reduced pListOfKeyValuesList if the actual KV was found in every list and there is at least one list without that key otherwise the unchanged pListOfKeyValuesList.
        Throws:
        PubServerException
        Since:
        4.1.0
      • getIDsOfIntersectionWithMissingKey

        public int[] getIDsOfIntersectionWithMissingKey​(KeyValue pCompKeyValue,
                                                        java.util.List<java.util.List<KeyValue>> pListOfKeyValuesList,
                                                        java.util.List<java.lang.String> compareCriteria,
                                                        int pIndexOfAktList,
                                                        int pPosInAktList)
                                                 throws PubServerException
        Look in pListOfKeyValuesList where to find the current key value in other lists and write the indexes of the found KV in an array to give them back.
        Here also is indicated if the Key of that current key value is NOT found in a list.
        Parameters:
        pCompKeyValue - The current key value to look for in every list.
        pListOfKeyValuesList - The list of key value lists where to look for the current key value.
        compareCriteria - List of elements those who will be checked for equality.
        pIndexOfAktList - The index of the actual list of ListOfKeyValuesList.
        pPosInAktList - The index of the actual KV in the actual list.
        Returns:
        array of indices of every KV-list where pAktKeyValue was found
        or -1 if the key of pAktKeyValue was not found.
        or -2 if the key of pAktKeyValue was found but with an other value.
        Throws:
        PubServerException
        Since:
        4.1.0
      • getIDsOfIntersectionWithMissingKey_UH

        public int[] getIDsOfIntersectionWithMissingKey_UH​(KeyValue pCompKeyValue,
                                                           java.util.List<java.util.List<KeyValue>> pListOfKeyValuesList,
                                                           java.util.List<java.lang.String> compareCriteria,
                                                           int pIndexOfAktList,
                                                           int pPosInAktList,
                                                           int[][] arrToRemember)
                                                    throws PubServerException
        Look in pListOfKeyValuesList for all unhandled KV's where to find the current key value in other lists and write the indexes of the found KV in an array to give them back.
        Here also is indicated if the Key of that current key value is NOT found in a list.
        Parameters:
        pCompKeyValue - The current key value to look for in every list.
        pListOfKeyValuesList - The list of key value lists where to look for the current key value.
        compareCriteria - List of elements those who will be checked for equality.
        pIndexOfAktList - The index of the actual list of ListOfKeyValuesList.
        pPosInAktList - The index of the actual KV in the actual list.
        Returns:
        array of indices of every KV-list where pAktKeyValue was found
        or -1 if the key of pAktKeyValue was not found.
        or -2 if the key of pAktKeyValue was found but with an other value.
        Throws:
        PubServerException
        Since:
        4.1.0
      • countValuesForVerglKey

        public int[] countValuesForVerglKey​(KeyValue pCompKeyValue,
                                            java.util.List<java.util.List<KeyValue>> pListOfKeyValuesList,
                                            java.util.List<java.lang.String> compareCriteria,
                                            int[][] arrToRemember)
                                     throws PubServerException
        Go throw all unhandled KV's of pListOfKeyValuesList and simply look for the amount of occurrence of a unhandled KV with the same key as from pCompKeyValue.
        Parameters:
        pCompKeyValue - The current key value to look for in every list.
        pListOfKeyValuesList - The list of key value lists where to look for the current key value.
        compareCriteria - List of elements those who will be checked for equality.
        arrToRemember - The help array with the same dimension as pListOfKeyValuesList to be able to find the handled KV's.
        Returns:
        Array, which shows for every list of List<List<KeyValue>> the amount of remaining KV with the same key as pCompKeyValue.
        Throws:
        PubServerException
        Since:
        4.1.0
      • markAktKeyAsHandeled

        public int[][] markAktKeyAsHandeled​(KeyValue pCompKeyValue,
                                            java.util.List<java.util.List<KeyValue>> pListOfKeyValuesList,
                                            java.util.List<java.lang.String> compareCriteria,
                                            int[][] arrToRemember)
                                     throws PubServerException
        Go throw all unhandled KV's pListOfKeyValuesList and mark all KV's which have the same key as verglKeyValue as handled.
        Parameters:
        pCompKeyValue - The current key value to look for in every list.
        pListOfKeyValuesList - The list of key value lists where to look for the current key value.
        compareCriteria - List of elements those who will be checked for equality.
        arrToRemember - The help array with the same dimension as pListOfKeyValuesList where to mark KV's as handled.
        Returns:
        Refreshed arrToRemember (refreshed for all KV's from pCompKeyValue).
        Throws:
        PubServerException
        Since:
        4.1.0
      • isNoMoreKVInOtherLists

        public boolean isNoMoreKVInOtherLists​(KeyValue pOriKeyValue,
                                              java.util.List<KeyValue> pFoundArrListKeyValue,
                                              java.util.List<java.util.List<KeyValue>> pListOfKeyValuesList,
                                              java.util.List<java.lang.String> compareCriteria)
                                       throws PubServerException
        Look in pListOfKeyValuesList if there is an value of the key of pOriKeyValue which is not in pFoundArrListKeyValue.
        This means intersection of all values of the key from pOriKeyValue is not allowed.
        Parameters:
        pOriKeyValue - The KV from the first list where intersection was found for.
        pFoundArrListKeyValue - The list of KV's with the same key as pOriKeyValue, where intersection was found for also.
        pListOfKeyValuesList - The list of key value lists we are working with.
        compareCriteria - List of elements those who will be checked for equality.
        Returns:
        isAlsoValueIdentical.
        Throws:
        PubServerException
        Since:
        4.1.0
      • markAsHandeled

        public int[][] markAsHandeled​(int[][] arrToRemember,
                                      KeyValue verglKeyValue,
                                      java.util.List<java.util.List<KeyValue>> pListOfKeyValuesList,
                                      java.util.List<java.lang.String> pCriteria,
                                      int pFrom)
                               throws PubServerException
        Every KV which is identical with KV of verglKeyValue will be marked as handled.
        Parameters:
        arrToRemember - The help array with the same dimension as pListOfKeyValuesList where to mark KV's as handled.
        verglKeyValue - The current key value that was found in some more lists.
        pListOfKeyValuesList - The list of key value lists we are working with.
        pCriteria - List of elements those who will be checked for equality.
        pFrom - List index of pListOfKeyValuesList which tells where to begin searching.
        Returns:
        Refreshed arrToRemember (refreshed for all KV's from verglKeyValue).
        Throws:
        PubServerException
        Since:
        4.1.0
      • getAmountOfAktKeyInAktList

        public int getAmountOfAktKeyInAktList​(KeyValue verglKeyValue,
                                              java.util.List<KeyValue> curKeyValueList,
                                              java.util.List<java.lang.String> pCriteria)
                                       throws PubServerException
        Counts in curKeyValueList the amount of Keys of verglKeyValue.
        Parameters:
        verglKeyValue - The current key value of which the key have to be count.
        curKeyValueList - The list where to look for amount of key.
        pCriteria - List of elements those who will be checked for equality.
        Returns:
        the amount of Keys.
        Throws:
        PubServerException
        Since:
        4.1.0
      • getAmountOfAktKeyInAllLists

        public int[] getAmountOfAktKeyInAllLists​(KeyValue verglKeyValue,
                                                 java.util.List<java.util.List<KeyValue>> pListOfKeyValuesList,
                                                 java.util.List<java.lang.String> pCriteria,
                                                 int[][] arrToRemember,
                                                 boolean pBreakCondition)
                                          throws PubServerException
        Counts the amount of Keys of verglKeyValue in ALL lists.
        Parameters:
        verglKeyValue - The current key value of which the key have to be count.
        pListOfKeyValuesList - The listOfList where to look for amount of key.
        pCriteria - List of elements those who will be checked for equality.
        arrToRemember - The help array with the same dimension as pListOfKeyValuesList where already handled KV's are marked out.
        pBreakCondition - To decide if to stop looping if amount of key > 1.
        Returns:
        array with the amount of Keys for every listOfList.
        Throws:
        PubServerException
        Since:
        4.1.0
      • isAmountOfAktKeyGreaterOne

        public boolean isAmountOfAktKeyGreaterOne​(KeyValue verglKeyValue,
                                                  java.util.List<java.util.List<KeyValue>> pListOfKeyValuesList,
                                                  java.util.List<java.lang.String> pCriteria,
                                                  int[][] arrToRemember)
                                           throws PubServerException
        Check if the key of verglKeyValue occurs more then once in at least one listOfList.
        Parameters:
        verglKeyValue - The current key value which has to be checked.
        pListOfKeyValuesList - The listOfList where to look for.
        pCriteria - List of elements those who will be checked for equality.
        arrToRemember - The help array with the same dimension as pListOfKeyValuesList where already handled KV's are marked out.
        Returns:
        true, if the key of verglKeyValue occurs more then once in at least one listOfList.
        Throws:
        PubServerException
        Since:
        4.1.0
      • areAllKVsIdentical

        public boolean areAllKVsIdentical​(KeyValue verglKeyValue,
                                          java.util.List<java.util.List<KeyValue>> pListOfKeyValuesList,
                                          java.util.List<java.lang.String> pCriteria)
                                   throws PubServerException
        Check if the value of verglKeyValue occurs in every list where is a key from verglKeyValue.
        Parameters:
        verglKeyValue - The current key value which has to be checked.
        pListOfKeyValuesList - The listOfList where to look for.
        pCriteria - List of elements those who will be checked for equality.
        Returns:
        true, if the value exist everywhere.
        Throws:
        PubServerException
        Since:
        4.1.0
      • getNextVerglKV

        public KeyValue getNextVerglKV​(KeyValue verglKeyValue,
                                       java.util.List<KeyValue> curKeyValueList,
                                       java.util.List<java.lang.String> compareCriteria,
                                       int[][] arrToRemember,
                                       int curIndex,
                                       int[] arrToHoldIDs)
                                throws PubServerException
        Search for the next unhandled KV with the same key out of curKeyValueList and his index.
        Parameters:
        verglKeyValue - The current key value which holds the key (or keylabel) which should be found again.
        curKeyValueList - The list where to look for the next same unhandled key (or keylabel).
        compareCriteria - List of elements those who will be checked for equality.
        arrToRemember - The help array with the same dimension as pListOfKeyValuesList where already handled KV's are marked out.
        curIndex - The beginning-condition from where on the key (or keylabel) chould be found again.
        arrToHoldIDs - The array where the index of the found next KV is written to.
        Returns:
        the next unhandled KV with the same key out of curKeyValueList and the index of this KV.
        Throws:
        PubServerException
        Since:
        4.1.0
      • isAnotherKV

        public boolean isAnotherKV​(KeyValue curKeyValue,
                                   java.util.List<KeyValue> unionArrListKeyValue,
                                   java.util.List<java.lang.String> criteria)
                            throws PubServerException
        Look if curKeyValue is not jet found in any list depending on the criteria.
        Parameters:
        curKeyValue - The current key value to look for in every list.
        unionArrListKeyValue - All up till now fitting keyValues.
        criteria - List of elements those who will be checked for equality. It can be checked for the criteria - key, - keyvalue, - keylabel.
        Returns:
        true, if the current key value was not found in any list, otherwise false.
        Throws:
        PubServerException
        Since:
        4.1.0
      • checkCriteria

        public java.util.List<java.lang.String> checkCriteria​(java.util.List<java.lang.String> curCriteria,
                                                              java.util.List<java.lang.String> defaultCriteria)
                                                       throws PubServerException
        Check if the parameter holds the correct criteria-values.
        Parameters:
        curCriteria - The criteria which have to be checked.
        defaultCriteria - If empty criteria list is received the default one must be used.
        Returns:
        List of the used criteria or a errormessage if wrong criteria are found.
        Throws:
        PubServerException
        Since:
        4.1.0