change == for equals and fixed equals methods
This commit is contained in:
parent
4c18bd07a2
commit
b620b6e5d6
@ -45,7 +45,7 @@ public class RefListsView extends JFrame {
|
|||||||
JButton viewBPHQ = new JButton("BPHQ");
|
JButton viewBPHQ = new JButton("BPHQ");
|
||||||
viewBPHQ.addActionListener(new ActionListener() {
|
viewBPHQ.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent arg0) {
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
Reference.getBPHQ().view();
|
Reference.getBB().view();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
add(viewBPHQ);
|
add(viewBPHQ);
|
||||||
|
@ -78,7 +78,7 @@ public class Album extends FMObj {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
Album album = (Album) obj;
|
Album album = (Album) obj;
|
||||||
if (getName() == album.getName())
|
if (getName().equals(album.getName()))
|
||||||
if (getArtist().equals(album.getArtist()))
|
if (getArtist().equals(album.getArtist()))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ public class Artist extends FMObj {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
Artist artist = (Artist) obj;
|
Artist artist = (Artist) obj;
|
||||||
if (getName() == artist.getName())
|
if (getName().equals(artist.getName()))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -10,7 +10,7 @@ public abstract class FMObj implements Comparable<FMObj>{
|
|||||||
|
|
||||||
protected int listeners;
|
protected int listeners;
|
||||||
protected int playCount;
|
protected int playCount;
|
||||||
protected int userPlayCount;
|
protected int userPlayCount = 0;
|
||||||
|
|
||||||
protected Wiki wiki;
|
protected Wiki wiki;
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ public class Track extends FMObj {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
Track track = (Track) obj;
|
Track track = (Track) obj;
|
||||||
if (getName() == track.getName())
|
if (getName().equals(track.getName()))
|
||||||
if (getArtist().equals(track.getArtist()))
|
if (getArtist().equals(track.getArtist()))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -3,7 +3,10 @@ package sarsoo.fmframework.util;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import sarsoo.fmframework.gui.FMObjListView;
|
import sarsoo.fmframework.gui.FMObjListView;
|
||||||
|
import sarsoo.fmframework.music.Album;
|
||||||
|
import sarsoo.fmframework.music.Artist;
|
||||||
import sarsoo.fmframework.music.FMObj;
|
import sarsoo.fmframework.music.FMObj;
|
||||||
|
import sarsoo.fmframework.music.Track;
|
||||||
|
|
||||||
public class FMObjList extends ArrayList<FMObj> {
|
public class FMObjList extends ArrayList<FMObj> {
|
||||||
|
|
||||||
@ -22,7 +25,53 @@ public class FMObjList extends ArrayList<FMObj> {
|
|||||||
int counter;
|
int counter;
|
||||||
int totalScrobbles = 0;
|
int totalScrobbles = 0;
|
||||||
for (counter = 0; counter < size(); counter++) {
|
for (counter = 0; counter < size(); counter++) {
|
||||||
totalScrobbles += get(counter).getUserPlayCount();
|
FMObj obj = get(counter);
|
||||||
|
|
||||||
|
if (obj.getClass() == Artist.class)
|
||||||
|
totalScrobbles += obj.getUserPlayCount();
|
||||||
|
|
||||||
|
else if (obj.getClass() == Track.class) {
|
||||||
|
Track track = (Track) obj;
|
||||||
|
|
||||||
|
Artist artist = track.getArtist();
|
||||||
|
|
||||||
|
boolean found = false;
|
||||||
|
int counter2;
|
||||||
|
for (counter2 = 0; counter2 < size(); counter2++) {
|
||||||
|
if (artist.equals(get(counter2))) {
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
totalScrobbles += obj.getUserPlayCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (!super.contains(track.getArtist())) {
|
||||||
|
// Album album = track.getAlbum();
|
||||||
|
// if (album != null) {
|
||||||
|
// if (!super.contains(album))
|
||||||
|
// totalScrobbles += obj.getUserPlayCount();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
else if (obj.getClass() == Album.class) {
|
||||||
|
Album album = (Album) obj;
|
||||||
|
|
||||||
|
Artist artist = album.getArtist();
|
||||||
|
|
||||||
|
boolean found = false;
|
||||||
|
int counter2;
|
||||||
|
for (counter2 = 0; counter2 < size(); counter2++) {
|
||||||
|
if (artist.equals(get(counter2))) {
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
totalScrobbles += obj.getUserPlayCount();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return totalScrobbles;
|
return totalScrobbles;
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ public class Reference {
|
|||||||
tde.add(Artist.getArtist("Jay Rock", Reference.getUserName()));
|
tde.add(Artist.getArtist("Jay Rock", Reference.getUserName()));
|
||||||
tde.add(Artist.getArtist("ScHoolboy Q", Reference.getUserName()));
|
tde.add(Artist.getArtist("ScHoolboy Q", Reference.getUserName()));
|
||||||
tde.add(Artist.getArtist("Ab-Soul", Reference.getUserName()));
|
tde.add(Artist.getArtist("Ab-Soul", Reference.getUserName()));
|
||||||
tde.add(Artist.getArtistByMbid("6fc5c0c6-bf05-4b29-bda0-5fa6cc863785", Reference.getUserName())); // Black Hippy
|
tde.add(Artist.getArtist("Black Hippy", Reference.getUserName()));
|
||||||
tde.add(Artist.getArtist("Isaiah Rashad", Reference.getUserName()));
|
tde.add(Artist.getArtist("Isaiah Rashad", Reference.getUserName()));
|
||||||
tde.add(Artist.getArtist("SZA", Reference.getUserName()));
|
tde.add(Artist.getArtist("SZA", Reference.getUserName()));
|
||||||
tde.add(Artist.getArtist("Sir", Reference.getUserName()));
|
tde.add(Artist.getArtist("Sir", Reference.getUserName()));
|
||||||
@ -87,14 +87,15 @@ public class Reference {
|
|||||||
return tde;
|
return tde;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FMObjList getBPHQ() {
|
public static FMObjList getBB() {
|
||||||
FMObjList bphq = new FMObjList("BPHQ");
|
FMObjList bphq = new FMObjList("British Rock");
|
||||||
|
|
||||||
bphq.add(Artist.getArtistByMbid("98edd2f1-d136-4c47-ab9b-c31839dd1d98", Reference.getUserName()));
|
bphq.add(Artist.getArtist("Deaf Havana", Reference.getUserName()));
|
||||||
bphq.add(Artist.getArtist("Lower Than Atlantis", Reference.getUserName()));
|
bphq.add(Artist.getArtist("Lower Than Atlantis", Reference.getUserName()));
|
||||||
bphq.add(Artist.getArtist("Mallory Knox", Reference.getUserName()));
|
bphq.add(Artist.getArtist("Mallory Knox", Reference.getUserName()));
|
||||||
bphq.add(Artist.getArtist("Don Broco", Reference.getUserName()));
|
bphq.add(Artist.getArtist("Don Broco", Reference.getUserName()));
|
||||||
bphq.add(Artist.getArtist("Moose Blood", Reference.getUserName()));
|
bphq.add(Artist.getArtist("Moose Blood", Reference.getUserName()));
|
||||||
|
bphq.add(Artist.getArtist("Young Guns", Reference.getUserName()));
|
||||||
|
|
||||||
return bphq;
|
return bphq;
|
||||||
}
|
}
|
||||||
@ -103,6 +104,8 @@ public class Reference {
|
|||||||
FMObjList dre = new FMObjList("Dre");
|
FMObjList dre = new FMObjList("Dre");
|
||||||
|
|
||||||
dre.add(Artist.getArtist("N.W.A", Reference.getUserName()));
|
dre.add(Artist.getArtist("N.W.A", Reference.getUserName()));
|
||||||
|
// dre.add(Album.getAlbum("Straight Outta Compton", "N.W.A", Reference.getUserName()));
|
||||||
|
// dre.add(Album.getAlbum("Doggystyle", "Snoop Dogg", Reference.getUserName()));
|
||||||
dre.add(Artist.getArtist("Dr. Dre", Reference.getUserName()));
|
dre.add(Artist.getArtist("Dr. Dre", Reference.getUserName()));
|
||||||
dre.add(Artist.getArtist("Snoop Dogg", Reference.getUserName()));
|
dre.add(Artist.getArtist("Snoop Dogg", Reference.getUserName()));
|
||||||
dre.add(Artist.getArtist("Eminem", Reference.getUserName()));
|
dre.add(Artist.getArtist("Eminem", Reference.getUserName()));
|
||||||
|
Loading…
Reference in New Issue
Block a user