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 an album.
21 * @author Andrew Neal (andrewdneal@gmail.com)
26 * The unique Id of the album
31 * The name of the album
33 public String mAlbumName;
38 public String mArtistName;
41 * The number of songs in the album
43 public int mSongNumber;
46 * The year the album was released
51 * Bucket label for the name - may not necessarily be the name - for example albums sorted by
52 * artists would be the artist bucket label and not the album name bucket label
54 public String mBucketLabel;
57 * Constructor of <code>Album</code>
59 * @param albumId The Id of the album
60 * @param albumName The name of the album
61 * @param artistName The album artist
62 * @param songNumber The number of songs in the album
63 * @param albumYear The year the album was released
65 public Album(final long albumId, final String albumName, final String artistName,
66 final int songNumber, final String albumYear) {
69 mAlbumName = albumName;
70 mArtistName = artistName;
71 mSongNumber = songNumber;
79 public int hashCode() {
82 result = prime * result + (int) mAlbumId;
83 result = prime * result + (mAlbumName == null ? 0 : mAlbumName.hashCode());
84 result = prime * result + (mArtistName == null ? 0 : mArtistName.hashCode());
85 result = prime * result + mSongNumber;
86 result = prime * result + (mYear == null ? 0 : mYear.hashCode());
94 public boolean equals(final Object obj) {
101 if (getClass() != obj.getClass()) {
104 final Album other = (Album)obj;
105 if (mAlbumId != other.mAlbumId) {
108 if (!TextUtils.equals(mAlbumName, other.mAlbumName)) {
111 if (!TextUtils.equals(mArtistName, other.mArtistName)) {
114 if (mSongNumber != other.mSongNumber) {
117 if (!TextUtils.equals(mYear, other.mYear)) {
127 public String toString() {