Class ClassificationUtils

    • Method Detail

      • getHigherClassification

        @Nullable
        public static String getHigherClassification​(LinneanClassification lc)
        Concatenates all higher Linnean taxa into a single dwc:higherClassification string, skipping null values.
        Parameters:
        lc - the LinneanClassification to join into the higher classification string
        Returns:
        the concatenated dwc:higherClassification string
      • getHigherRank

        @Nullable
        public static String getHigherRank​(LinneanClassification lc,
                                           Rank rank)
        Gets a higher taxon property by passing the rank of it. Only Linnean ranks are supported.
        Parameters:
        lc - the LinneanClassification holding the taxon property to be retrieved
        rank - the higher linnean rank to retrieve
        Returns:
        the name of the higher taxon or null if rank doesnt exist
      • setHigherRank

        public static void setHigherRank​(LinneanClassification lc,
                                         Rank rank,
                                         String name)
        Sets a higher taxon property by passing the rank of it.
        Parameters:
        lc - the LinneanClassification on which to set the new property
        rank - the higher linnean rank to set
        name - the higher ranks name
      • getHigherClassificationMap

        @NotNull
        public static <T extends LinneanClassification & LinneanClassificationKeys> @NotNull LinkedHashMap<Integer,​StringgetHigherClassificationMap​(T lc)
        An ordered map with entries for all higher Linnean ranks down to species which are not null. The map starts with the highest rank, e.g. the kingdom and maps the name usage key to its canonical name.
        Parameters:
        lc - the object that implements both LinneanClassification and LinneanClassificationKeys from which to build the map
        Returns:
        map of higher ranks
      • getHigherClassificationMap

        @NotNull
        public static <T extends LinneanClassification & LinneanClassificationKeys> @NotNull LinkedHashMap<Integer,​StringgetHigherClassificationMap​(T lc,
                                                                                                                                                            int key,
                                                                                                                                                            Integer parentKey,
                                                                                                                                                            String parent)
        An ordered map with entries for all higher Linnean ranks down to the actual direct parent of this usage. The map starts with the highest rank, e.g. the kingdom and maps the name usage key to its canonical name. The name usage itself is never included, even though a higher rank might point to the usage itself.
        Parameters:
        lc - the object that implements both LinneanClassification and LinneanClassificationKeys from which to build the map
        Returns:
        map of higher ranks
      • getHigherRankKey

        @Nullable
        public static Integer getHigherRankKey​(LinneanClassificationKeys lck,
                                               Rank rank)
        Gets a higher taxon key by passing the rank of it. Only Linnean ranks are supported.
        Parameters:
        lck - the classification that holds the taxon key
        rank - the higher linnean rank to retrieve
        Returns:
        the key of the higher taxon or null if rank doesnt exist
      • setHigherRankKey

        public static void setHigherRankKey​(LinneanClassificationKeys lck,
                                            Rank rank,
                                            Integer usageKey)
        Sets a higher taxon property by passing the rank of it.
        Parameters:
        lck - the classification on which to set the taxon property
        rank - the higher rank to set
        usageKey - key of the higher ranks usage
      • setHigherRank

        public static <T extends LinneanClassification & LinneanClassificationKeys> void setHigherRank​(T lc,
                                                                                                       Rank rank,
                                                                                                       String name,
                                                                                                       Integer usageKey)
        Sets a higher taxon property by passing the rank of it.
        Parameters:
        lc - the object that implements both LinneanClassification and LinneanClassificationKeys on which to set the taxon property
        rank - the higher linnean rank to set
        name - the higher ranks name
        usageKey - key of the higher ranks usage
      • hasContent

        public static boolean hasContent​(LinneanClassification lc)
        Returns:
        true if at least one higher rank of the classification is given, i.e. not null or empty