OSDN Git Service

Eleven: Cleanup all the whitespace
[android-x86/packages-apps-Eleven.git] / src / com / cyanogenmod / eleven / model / Artist.java
1 /*
2  * Copyright (C) 2012 Andrew Neal
3  * Copyright (C) 2014 The CyanogenMod Project
4  * Licensed under the Apache License, Version 2.0
5  * (the "License"); you may not use this file except in compliance with the
6  * License. You may obtain a copy of the License at
7  * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
8  * or agreed to in writing, software distributed under the License is
9  * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
10  * KIND, either express or implied. See the License for the specific language
11  * governing permissions and limitations under the License.
12  */
13
14 package com.cyanogenmod.eleven.model;
15
16 import android.text.TextUtils;
17
18 /**
19  * A class that represents an artist.
20  *
21  * @author Andrew Neal (andrewdneal@gmail.com)
22  */
23 public class Artist {
24
25     /**
26      * The unique Id of the artist
27      */
28     public long mArtistId;
29
30     /**
31      * The artist name
32      */
33     public String mArtistName;
34
35     /**
36      * The number of albums for the artist
37      */
38     public int mAlbumNumber;
39
40     /**
41      * The number of songs for the artist
42      */
43     public int mSongNumber;
44
45     /**
46      * Bucket label for the artist name if it exists
47      */
48     public String mBucketLabel;
49
50     /**
51      * Constructor of <code>Artist</code>
52      *
53      * @param artistId The Id of the artist
54      * @param artistName The artist name
55      * @param songNumber The number of songs for the artist
56      * @param albumNumber The number of albums for the artist
57      */
58     public Artist(final long artistId, final String artistName, final int songNumber,
59             final int albumNumber) {
60         super();
61         mArtistId = artistId;
62         mArtistName = artistName;
63         mSongNumber = songNumber;
64         mAlbumNumber = albumNumber;
65     }
66
67     /**
68      * {@inheritDoc}
69      */
70     @Override
71     public int hashCode() {
72         final int prime = 31;
73         int result = 1;
74         result = prime * result + mAlbumNumber;
75         result = prime * result + (int) mArtistId;
76         result = prime * result + (mArtistName == null ? 0 : mArtistName.hashCode());
77         result = prime * result + mSongNumber;
78         return result;
79     }
80
81     /**
82      * {@inheritDoc}
83      */
84     @Override
85     public boolean equals(final Object obj) {
86         if (this == obj) {
87             return true;
88         }
89         if (obj == null) {
90             return false;
91         }
92         if (getClass() != obj.getClass()) {
93             return false;
94         }
95         final Artist other = (Artist)obj;
96         if (mAlbumNumber != other.mAlbumNumber) {
97             return false;
98         }
99         if (mArtistId != other.mArtistId) {
100             return false;
101         }
102         if (!TextUtils.equals(mArtistName, other.mArtistName)) {
103             return false;
104         }
105         if (mSongNumber != other.mSongNumber) {
106             return false;
107         }
108         return true;
109     }
110
111     /**
112      * {@inheritDoc}
113      */
114     @Override
115     public String toString() {
116         return mArtistName;
117     }
118
119 }