-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUser.java
More file actions
88 lines (76 loc) · 2.18 KB
/
User.java
File metadata and controls
88 lines (76 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package queuecode;
import java.util.*;
public class User
{
String us;
String pwd;
String bio;
String[] artist;
String[] lang;
String[] genre;
User(String us, String pwd, String bio,String[] artist, String[] lang, String[] genre) {
this.us = us;
this.pwd = pwd;
this.bio = bio;
this.artist=artist;
this.lang = lang;
this.genre= genre;
}
public PriorityQueue <Integer> apqueue= new PriorityQueue<Integer>();
public PriorityQueue <Integer> lpqueue= new PriorityQueue<Integer>();
public PriorityQueue <Integer> gpqueue= new PriorityQueue<Integer>();
public PriorityQueue <Integer> lapqueue= new PriorityQueue<Integer>();
public PriorityQueue <Integer> llpqueue= new PriorityQueue<Integer>();
public PriorityQueue <Integer> lgpqueue= new PriorityQueue<Integer>();
public int compareTo(Artist other)
{
return other.likecount*2+other.listencount*3+other.commentcount+other.sharecount;
}
public int compareTo(Lang other)
{
return other.likecount*2+other.listencount*5;
}
public int compareTo(Genre other)
{
return other.likecount*2+other.listencount*5;
}
public void addartist()
{
for(int i=0; i< artist.length; i++)
{
Artist a= new Artist(artist[i], 1,0, 0,0);
apqueue.add(a.likecount);
lapqueue.add(a.listencount);
}
}
public void addgenre()
{
for(int i=0; i< genre.length; i++)
{
Genre g= new Genre(genre[i], 1, 0,0,0);
gpqueue.add(g.likecount);
lgpqueue.add(g.listencount);
}
}
public void addlang()
{
for(int i=0; i< lang.length; i++)
{
Lang l= new Lang(lang[i], 1, 0,0,0);
lpqueue.add(l.likecount);
llpqueue.add(l.listencount);
}
}
public void showData()
{
addartist();
addlang();
addgenre();
int artistlikerate=apqueue.poll()/lapqueue.poll();
int langlikerate=lpqueue.poll()/llpqueue.poll();
int genrelikerate=gpqueue.poll()/lgpqueue.poll();
System.out.println("Artist like rate of most listened to artist= "+ artistlikerate);
System.out.println("Language like rate of most listened to artist= "+ langlikerate);
System.out.println("Genre like rate of most listened to artist= "+ genrelikerate);
}
}