Coverage Report - org.jaudiotagger.tag.reference.GenreTypes
 
Classes in this File Line Coverage Branch Coverage Complexity
GenreTypes
100%
160/160
100%
4/4
1.5
 
 1  
 /**
 2  
  * @author : Paul Taylor
 3  
  * <p/>
 4  
  * Version @version:$Id: GenreTypes.java 836 2009-11-12 15:44:07Z paultaylor $
 5  
  * <p/>
 6  
  * Jaudiotagger Copyright (C)2004,2005
 7  
  * <p/>
 8  
  * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser
 9  
  * General Public  License as published by the Free Software Foundation; either version 2.1 of the License,
 10  
  * or (at your option) any later version.
 11  
  * <p/>
 12  
  * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
 13  
  * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 14  
  * See the GNU Lesser General Public License for more details.
 15  
  * <p/>
 16  
  * You should have received a copy of the GNU Lesser General Public License ainteger with this library; if not,
 17  
  * you can get a copy from http://www.opensource.org/licenses/lgpl-license.php or write to the Free Software
 18  
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 19  
  * <p/>
 20  
  * Description:
 21  
  */
 22  
 package org.jaudiotagger.tag.reference;
 23  
 
 24  
 import org.jaudiotagger.tag.datatype.AbstractIntStringValuePair;
 25  
 
 26  
 import java.util.LinkedHashMap;
 27  
 import java.util.Map;
 28  
 
 29  
 /**
 30  
  * Genre list
 31  
  * <p/>
 32  
  * <p>This is the IDv1 list with additional values as defined by Winamp, this list is also used in Mp4
 33  
  * files, note iTunes doesn't understand genres above MAX_STANDARD_GENRE_ID, Winamp does</p>
 34  
  */
 35  
 public class GenreTypes extends AbstractIntStringValuePair
 36  
 {
 37  4
     private static int MAX_STANDARD_GENRE_ID = 125;
 38  
 
 39  
     /**
 40  
      * @return the maximum genreId that is part of the official Standard, genres above this were added by
 41  
      *         winamp later.
 42  
      */
 43  
     public static int getMaxStandardGenreId()
 44  
     {
 45  80
         return MAX_STANDARD_GENRE_ID;
 46  
     }
 47  
 
 48  
     private static GenreTypes genreTypes;
 49  
 
 50  
     public static GenreTypes getInstanceOf()
 51  
     {
 52  3438
         if (genreTypes == null)
 53  
         {
 54  4
             genreTypes = new GenreTypes();
 55  
         }
 56  3438
         return genreTypes;
 57  
     }
 58  
 
 59  
     //This maps the lowercase version to the id, so applications can map from the lowercase value to the id
 60  
     private Map<String, Integer> nameToIdMap;
 61  
 
 62  
 
 63  
     private GenreTypes()
 64  4
     {
 65  4
         idToValue.put(0, "Blues");
 66  4
         idToValue.put(1, "Classic Rock");
 67  4
         idToValue.put(2, "Country");
 68  4
         idToValue.put(3, "Dance");
 69  4
         idToValue.put(4, "Disco");
 70  4
         idToValue.put(5, "Funk");
 71  4
         idToValue.put(6, "Grunge");
 72  4
         idToValue.put(7, "Hip-Hop");
 73  4
         idToValue.put(8, "Jazz");
 74  4
         idToValue.put(9, "Metal");
 75  4
         idToValue.put(10, "New Age");
 76  4
         idToValue.put(11, "Oldies");
 77  4
         idToValue.put(12, "Other");
 78  4
         idToValue.put(13, "Pop");
 79  4
         idToValue.put(14, "R&B");
 80  4
         idToValue.put(15, "Rap");
 81  4
         idToValue.put(16, "Reggae");
 82  4
         idToValue.put(17, "Rock");
 83  4
         idToValue.put(18, "Techno");
 84  4
         idToValue.put(19, "Industrial");
 85  4
         idToValue.put(20, "Alternative");
 86  4
         idToValue.put(21, "Ska");
 87  4
         idToValue.put(22, "Death Metal");
 88  4
         idToValue.put(23, "Pranks");
 89  4
         idToValue.put(24, "Soundtrack");
 90  4
         idToValue.put(25, "Euro-Techno");
 91  4
         idToValue.put(26, "Ambient");
 92  4
         idToValue.put(27, "Trip-Hop");
 93  4
         idToValue.put(28, "Vocal");
 94  4
         idToValue.put(29, "Jazz+Funk");
 95  4
         idToValue.put(30, "Fusion");
 96  4
         idToValue.put(31, "Trance");
 97  4
         idToValue.put(32, "Classical");
 98  4
         idToValue.put(33, "Instrumental");
 99  4
         idToValue.put(34, "Acid");
 100  4
         idToValue.put(35, "House");
 101  4
         idToValue.put(36, "Game");
 102  4
         idToValue.put(37, "Sound Clip");
 103  4
         idToValue.put(38, "Gospel");
 104  4
         idToValue.put(39, "Noise");
 105  4
         idToValue.put(40, "AlternRock");
 106  4
         idToValue.put(41, "Bass");
 107  4
         idToValue.put(42, "Soul");
 108  4
         idToValue.put(43, "Punk");
 109  4
         idToValue.put(44, "Space");
 110  4
         idToValue.put(45, "Meditative");
 111  4
         idToValue.put(46, "Instrumental Pop");
 112  4
         idToValue.put(47, "Instrumental Rock");
 113  4
         idToValue.put(48, "Ethnic");
 114  4
         idToValue.put(49, "Gothic");
 115  4
         idToValue.put(50, "Darkwave");
 116  4
         idToValue.put(51, "Techno-Industrial");
 117  4
         idToValue.put(52, "Electronic");
 118  4
         idToValue.put(53, "Pop-Folk");
 119  4
         idToValue.put(54, "Eurodance");
 120  4
         idToValue.put(55, "Dream");
 121  4
         idToValue.put(56, "Southern Rock");
 122  4
         idToValue.put(57, "Comedy");
 123  4
         idToValue.put(58, "Cult");
 124  4
         idToValue.put(59, "Gangsta");
 125  4
         idToValue.put(60, "Top 40");
 126  4
         idToValue.put(61, "Christian Rap");
 127  4
         idToValue.put(62, "Pop/Funk");
 128  4
         idToValue.put(63, "Jungle");
 129  4
         idToValue.put(64, "Native American");
 130  4
         idToValue.put(65, "Cabaret");
 131  4
         idToValue.put(66, "New Wave");
 132  4
         idToValue.put(67, "Psychadelic");
 133  4
         idToValue.put(68, "Rave");
 134  4
         idToValue.put(69, "Showtunes");
 135  4
         idToValue.put(70, "Trailer");
 136  4
         idToValue.put(71, "Lo-Fi");
 137  4
         idToValue.put(72, "Tribal");
 138  4
         idToValue.put(73, "Acid Punk");
 139  4
         idToValue.put(74, "Acid Jazz");
 140  4
         idToValue.put(75, "Polka");
 141  4
         idToValue.put(76, "Retro");
 142  4
         idToValue.put(77, "Musical");
 143  4
         idToValue.put(78, "Rock & Roll");
 144  4
         idToValue.put(79, "Hard Rock");
 145  4
         idToValue.put(80, "Folk");
 146  4
         idToValue.put(81, "Folk-Rock");
 147  4
         idToValue.put(82, "National Folk");
 148  4
         idToValue.put(83, "Swing");
 149  4
         idToValue.put(84, "Fast Fusion");
 150  4
         idToValue.put(85, "Bebob");
 151  4
         idToValue.put(86, "Latin");
 152  4
         idToValue.put(87, "Revival");
 153  4
         idToValue.put(88, "Celtic");
 154  4
         idToValue.put(89, "Bluegrass");
 155  4
         idToValue.put(90, "Avantgarde");
 156  4
         idToValue.put(91, "Gothic Rock");
 157  4
         idToValue.put(92, "Progressive Rock");
 158  4
         idToValue.put(93, "Psychedelic Rock");
 159  4
         idToValue.put(94, "Symphonic Rock");
 160  4
         idToValue.put(95, "Slow Rock");
 161  4
         idToValue.put(96, "Big Band");
 162  4
         idToValue.put(97, "Chorus");
 163  4
         idToValue.put(98, "Easy Listening");
 164  4
         idToValue.put(99, "Acoustic");
 165  4
         idToValue.put(100, "Humour");
 166  4
         idToValue.put(101, "Speech");
 167  4
         idToValue.put(102, "Chanson");
 168  4
         idToValue.put(103, "Opera");
 169  4
         idToValue.put(104, "Chamber Music");
 170  4
         idToValue.put(105, "Sonata");
 171  4
         idToValue.put(106, "Symphony");
 172  4
         idToValue.put(107, "Booty Bass");
 173  4
         idToValue.put(108, "Primus");
 174  4
         idToValue.put(109, "Porn Groove");
 175  4
         idToValue.put(110, "Satire");
 176  4
         idToValue.put(111, "Slow Jam");
 177  4
         idToValue.put(112, "Club");
 178  4
         idToValue.put(113, "Tango");
 179  4
         idToValue.put(114, "Samba");
 180  4
         idToValue.put(115, "Folklore");
 181  4
         idToValue.put(116, "Ballad");
 182  4
         idToValue.put(117, "Power Ballad");
 183  4
         idToValue.put(118, "Rhythmic Soul");
 184  4
         idToValue.put(119, "Freestyle");
 185  4
         idToValue.put(120, "Duet");
 186  4
         idToValue.put(121, "Punk Rock");
 187  4
         idToValue.put(122, "Drum Solo");
 188  4
         idToValue.put(123, "Acapella");
 189  4
         idToValue.put(124, "Euro-House");
 190  4
         idToValue.put(125, "Dance Hall");
 191  4
         idToValue.put(126, "Goa");
 192  4
         idToValue.put(127, "Drum & Bass");
 193  4
         idToValue.put(128, "Club-House");
 194  4
         idToValue.put(129, "Hardcore");
 195  4
         idToValue.put(130, "Terror");
 196  4
         idToValue.put(131, "Indie");
 197  4
         idToValue.put(132, "BritPop");
 198  4
         idToValue.put(133, "Negerpunk");
 199  4
         idToValue.put(134, "Polsk Punk");
 200  4
         idToValue.put(135, "Beat");
 201  4
         idToValue.put(136, "Christian Gangsta Rap");
 202  4
         idToValue.put(137, "Heavy Metal");
 203  4
         idToValue.put(138, "Black Metal");
 204  4
         idToValue.put(139, "Crossover");
 205  4
         idToValue.put(140, "Contemporary Christian");
 206  4
         idToValue.put(141, "Christian Rock");
 207  4
         idToValue.put(142, "Merengue");
 208  4
         idToValue.put(143, "Salsa");
 209  4
         idToValue.put(144, "Thrash Metal");
 210  4
         idToValue.put(145, "Anime");
 211  4
         idToValue.put(146, "JPop");
 212  4
         idToValue.put(147, "SynthPop");
 213  
 
 214  4
         createMaps();
 215  
 
 216  
         //We now need to map from lowercase version to Id
 217  4
         nameToIdMap = new LinkedHashMap<String, Integer>(idToValue.size());
 218  4
         for (Map.Entry<Integer, String> entry : idToValue.entrySet())
 219  
         {
 220  592
             nameToIdMap.put(entry.getValue().toLowerCase(), entry.getKey());
 221  
         }
 222  4
     }
 223  
 
 224  
     /**
 225  
      * Get Id for name, match is not case sensitive
 226  
      * @param name
 227  
      * @return
 228  
      */
 229  
     public Integer getIdForName(String name)
 230  
     {
 231  1196
         return nameToIdMap.get(name.toLowerCase());
 232  
     }
 233  
 }