OSDN Git Service

ef51f94607d732bfc06cbf84728ff0689b31519f
[android-x86/packages-apps-Eleven.git] / src / com / andrew / apollo / model / Playlist.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 playlist.
18  * 
19  * @author Andrew Neal (andrewdneal@gmail.com)
20  */
21 public class Playlist {
22
23     /**
24      * The unique Id of the playlist
25      */
26     public long mPlaylistId;
27
28     /**
29      * The playlist name
30      */
31     public String mPlaylistName;
32
33     /**
34      * Constructor of <code>Genre</code>
35      * 
36      * @param playlistId The Id of the playlist
37      * @param playlistName The playlist name
38      */
39     public Playlist(final long playlistId, final String playlistName) {
40         super();
41         mPlaylistId = playlistId;
42         mPlaylistName = playlistName;
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) mPlaylistId;
53         result = prime * result + (mPlaylistName == null ? 0 : mPlaylistName.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 Playlist other = (Playlist)obj;
72         if (mPlaylistId != other.mPlaylistId) {
73             return false;
74         }
75         return TextUtils.equals(mPlaylistName, other.mPlaylistName);
76     }
77
78     /**
79      * {@inheritDoc}
80      */
81     @Override
82     public String toString() {
83         return mPlaylistName;
84     }
85
86 }