Interface AudioGenre

    • Method Detail

      • getDescription

        String getDescription()
      • getName

        String getName()
        Default name.
        Returns:
        name
      • getName

        String getName​(Locale locale)
        Attempts to return a genre name suitable for the given locale taking both language and country into account. If a country match fails, just the language is used. If that fails too, null is returned.
        Parameters:
        locale - locale
        Returns:
        localized genre name, if at all possible
      • getIds

        Set<AudioId> getIds()

        Ids for this genre.

        Returns:
        ids
      • getParents

        Set<AudioGenre> getParents()
        Set of parents. Fusion genres typically have more than one parent.
        Returns:
        parent set
      • getLevel

        default int getLevel()

        Level is defined as the length of the shortest path to a genre without parents navigating only the parent link. A genre without parents always has the level 0. A genre with parents, but no grand-parents has level 1, and so on.

        The default implementation is not efficient.

        Returns:
        length of shortest path to a root genre
      • isRoot

        default boolean isRoot()

        Does this genre have parents or is it a root genre?

        Returns:
        true or false
      • findPathTo

        default List<AudioGenre> findPathTo​(AudioGenre genre)
        Find a short path from this genre to another. If no path is found, an empty path is returned. If the two genres are identical, a path with just one element is returned.
        Parameters:
        genre - other genre
        Returns:
        a path or an empty list
      • findPath

        static List<AudioGenre> findPath​(AudioGenre genre1,
                                         AudioGenre genre2)
        Find a short path from one genre to another. If no path is found, an empty path is returned. If the two genres are identical, a path with just one element is returned.
        Parameters:
        genre1 - genre 1
        genre2 - genre 2
        Returns:
        a path from genre1 to genre2.
      • pathsToRoot

        static List<List<AudioGenre>> pathsToRoot​(AudioGenre genre,
                                                  List<AudioGenre> pathToGenre)
        Returns all possible paths to a root (genre without parent) using getParents(). The paths contain the root genre and the genre we started from. The returned paths are orders, beginning with the shortest possible path.
        Parameters:
        genre - genre
        Returns:
        possible paths to root