OSDN Git Service

796613de60d9609bdfe7bf80587e45be637d36a0
[android-x86/packages-apps-Eleven.git] / src / com / andrew / apollo / model / Genre.java
1 /*
2  * Copyright (C) 2012 Andrew Neal Licensed under the Apache License, Version 2.0
3  * (the "License"); you may not use this file except in compliance with the
4  * License. You may obtain a copy of the License at
5  * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
6  * or agreed to in writing, software distributed under the License is
7  * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8  * KIND, either express or implied. See the License for the specific language
9  * governing permissions and limitations under the License.
10  */
11
12 package com.andrew.apollo.model;
13
14 import android.text.TextUtils;
15
16 /**
17  * A class that represents a genre.
18  * 
19  * @author Andrew Neal (andrewdneal@gmail.com)
20  */
21 public class Genre {
22
23     /**
24      * The unique Id of the genre
25      */
26     public long mGenreId;
27
28     /**
29      * The genre name
30      */
31     public String mGenreName;
32
33     /**
34      * Constructor of <code>Genre</code>
35      * 
36      * @param genreId The Id of the genre
37      * @param genreName The genre name
38      */
39     public Genre(final long genreId, final String genreName) {
40         super();
41         mGenreId = genreId;
42         mGenreName = genreName;
43     }
44
45     /**
46      * {@inheritDoc}
47      */
48     @Override
49     public int hashCode() {
50         final int prime = 31;
51         int result = 1;
52         result = prime * result + (int) mGenreId;
53         result = prime * result + (mGenreName == null ? 0 : mGenreName.hashCode());
54         return result;
55     }
56
57     /**
58      * {@inheritDoc}
59      */
60     @Override
61     public boolean equals(final Object obj) {
62         if (this == obj) {
63             return true;
64         }
65         if (obj == null) {
66             return false;
67         }
68         if (getClass() != obj.getClass()) {
69             return false;
70         }
71         final Genre other = (Genre)obj;
72         if (mGenreId != other.mGenreId) {
73             return false;
74         }
75         return TextUtils.equals(mGenreName, other.mGenreName);
76     }
77
78     /**
79      * {@inheritDoc}
80      */
81     @Override
82     public String toString() {
83         return mGenreName;
84     }
85
86 }