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.
14 package com.cyanogenmod.eleven.model;
16 import android.text.TextUtils;
19 * A class that represents a playlist.
21 * @author Andrew Neal (andrewdneal@gmail.com)
23 public class Playlist {
26 * The unique Id of the playlist
28 public long mPlaylistId;
33 public String mPlaylistName;
36 * The number of songs in this playlist
38 public int mSongCount;
41 * Constructor of <code>Genre</code>
43 * @param playlistId The Id of the playlist
44 * @param playlistName The playlist name
46 public Playlist(final long playlistId, final String playlistName, final int songCount) {
48 mPlaylistId = playlistId;
49 mPlaylistName = playlistName;
50 mSongCount = songCount;
57 public int hashCode() {
60 result = prime * result + (int) mPlaylistId;
61 result = prime * result + (mPlaylistName == null ? 0 : mPlaylistName.hashCode());
62 result = prime * result + mSongCount;
70 public boolean equals(final Object obj) {
77 if (getClass() != obj.getClass()) {
80 final Playlist other = (Playlist)obj;
81 if (mPlaylistId != other.mPlaylistId) {
85 if (mSongCount != other.mSongCount) {
89 return TextUtils.equals(mPlaylistName, other.mPlaylistName);
96 public String toString() {
101 * @return true if this is a smart playlist
103 public boolean isSmartPlaylist() {
104 return mPlaylistId < 0;