Class Music


  • public class Music
    extends java.lang.Object
    This class provides methods for interacting with music, including retrieving songs, checking if a song is unlocked, and getting the total number of songs.
    • Constructor Summary

      Constructors 
      Constructor Description
      Music()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Song getSong​(java.lang.String name)
      Retrieves a specific song by its name.
      static int getTotalSongs()
      Returns the total number of songs.
      static boolean isSongUnlocked​(java.lang.String name)
      Determines if a specific song is unlocked for the player.
      static boolean isSongUnlocked​(Song song)
      Checks if a given song is unlocked.
      • Methods inherited from class java.lang.Object

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

      • Music

        public Music()
    • Method Detail

      • getSong

        public static Song getSong​(java.lang.String name)
        Retrieves a specific song by its name.
        Parameters:
        name - the name of the song
        Returns:
        the Song object corresponding to the given name
      • isSongUnlocked

        public static boolean isSongUnlocked​(Song song)
        Checks if a given song is unlocked.
        Parameters:
        song - the song to check for unlocking
        Returns:
        true if the song is unlocked, false otherwise
      • isSongUnlocked

        public static boolean isSongUnlocked​(java.lang.String name)
        Determines if a specific song is unlocked for the player.
        Parameters:
        name - the name of the song
        Returns:
        true if the song is unlocked, otherwise false
      • getTotalSongs

        public static int getTotalSongs()
        Returns the total number of songs.
        Returns:
        the total number of songs, or -1 if an exception occurs.