1 /*
2  * Copyright (C) 2018 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.bluetooth.avrcp;
18 
19 import java.util.Objects;
20 
21 class Metadata implements Cloneable {
22     public String mediaId;
23     public String title;
24     public String artist;
25     public String album;
26     public String trackNum;
27     public String numTracks;
28     public String genre;
29     public String duration;
30 
31     @Override
clone()32     public Metadata clone() {
33         Metadata data = new Metadata();
34         data.mediaId = mediaId;
35         data.title = title;
36         data.artist = artist;
37         data.album = album;
38         data.trackNum = trackNum;
39         data.numTracks = numTracks;
40         data.genre = genre;
41         data.duration = duration;
42         return data;
43     }
44 
45     @Override
equals(Object o)46     public boolean equals(Object o) {
47         if (o == null) return false;
48         if (!(o instanceof Metadata)) return false;
49 
50         final Metadata m = (Metadata) o;
51         if (!Objects.equals(title, m.title)) return false;
52         if (!Objects.equals(artist, m.artist)) return false;
53         if (!Objects.equals(album, m.album)) return false;
54         return true;
55     }
56 
57     @Override
toString()58     public String toString() {
59         return "{ mediaId=\"" + mediaId + "\" title=\"" + title + "\" artist=\"" + artist
60                 + "\" album=\"" + album + "\" duration=" + duration
61                 + " trackPosition=" + trackNum + "/" + numTracks + " }";
62 
63     }
64 }
65