FileDocCategorySizeDatePackage
ID3v1Genre.javaAPI DocMyID3 for Android6585Wed Oct 08 18:09:52 BST 2008org.cmc.music.common

ID3v1Genre

public class ID3v1Genre extends Object

Fields Summary
public final int
id
public final String
name
private static final ID3v1Genre[]
ALL
private static final Map
ID_TO_NAME_MAP
private static final Map
NAME_TO_ID_MAP
private static final Map
SIMPLE_NAME_TO_ID_MAP
Constructors Summary
public ID3v1Genre(int id, String name)

		this.id = id;
		this.name = name;
	
Methods Summary
public static final java.lang.Numberget(java.lang.String name)


	
	
		for (int i = 0; i < ALL.length; i++)
		{
			ID3v1Genre genre = ALL[i];

			String name = genre.name;
			Number id = new Integer(genre.id);

			ID_TO_NAME_MAP.put(id, name);
			NAME_TO_ID_MAP.put(name, id);

			String simple = simplify(name);
			SIMPLE_NAME_TO_ID_MAP.put(simple, id);
		}
	
		Number result = (Number) NAME_TO_ID_MAP.get(name);
		if (result != null)
			return result;

		String simple = simplify(name);

		result = (Number) SIMPLE_NAME_TO_ID_MAP.get(simple);
		return result;
	
public static final java.lang.Stringget(java.lang.Number id)

		return (String) ID_TO_NAME_MAP.get(id);
	
private static final java.lang.Stringsimplify(java.lang.String s)


	     
	
		StringBuffer result = new StringBuffer();

		char chars[] = s.toCharArray();
		for (int i = 0; i < chars.length; i++)
		{
			char c = chars[i];
			if (Character.isLetter(c))
				result.append(Character.toLowerCase(c));
			else if (Character.isDigit(c))
				result.append(c);
			else
				;
		}

		return result.toString();