OSDN Git Service

Repackaged com.andrew.apollo to com.cyngn.eleven
[android-x86/packages-apps-Eleven.git] / src / com / cyngn / eleven / model / Artist.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.cyngn.eleven.model;
13
14 import android.text.TextUtils;
15
16 /**
17  * A class that represents an artist.
18  * 
19  * @author Andrew Neal (andrewdneal@gmail.com)
20  */
21 public class Artist {
22
23     /**
24      * The unique Id of the artist
25      */
26     public long mArtistId;
27
28     /**
29      * The artist name
30      */
31     public String mArtistName;
32
33     /**
34      * The number of albums for the artist
35      */
36     public int mAlbumNumber;
37
38     /**
39      * The number of songs for the artist
40      */
41     public int mSongNumber;
42
43     /**
44      * Constructor of <code>Artist</code>
45      * 
46      * @param artistId The Id of the artist
47      * @param artistName The artist name
48      * @param songNumber The number of songs for the artist
49      * @param albumNumber The number of albums for the artist
50      */
51     public Artist(final long artistId, final String artistName, final int songNumber,
52             final int albumNumber) {
53         super();
54         mArtistId = artistId;
55         mArtistName = artistName;
56         mSongNumber = songNumber;
57         mAlbumNumber = albumNumber;
58     }
59
60     /**
61      * {@inheritDoc}
62      */
63     @Override
64     public int hashCode() {
65         final int prime = 31;
66         int result = 1;
67         result = prime * result + mAlbumNumber;
68         result = prime * result + (int) mArtistId;
69         result = prime * result + (mArtistName == null ? 0 : mArtistName.hashCode());
70         result = prime * result + mSongNumber;
71         return result;
72     }
73
74     /**
75      * {@inheritDoc}
76      */
77     @Override
78     public boolean equals(final Object obj) {
79         if (this == obj) {
80             return true;
81         }
82         if (obj == null) {
83             return false;
84         }
85         if (getClass() != obj.getClass()) {
86             return false;
87         }
88         final Artist other = (Artist)obj;
89         if (mAlbumNumber != other.mAlbumNumber) {
90             return false;
91         }
92         if (mArtistId != other.mArtistId) {
93             return false;
94         }
95         if (!TextUtils.equals(mArtistName, other.mArtistName)) {
96             return false;
97         }
98         if (mSongNumber != other.mSongNumber) {
99             return false;
100         }
101         return true;
102     }
103
104     /**
105      * {@inheritDoc}
106      */
107     @Override
108     public String toString() {
109         return mArtistName;
110     }
111
112 }