shikeying
2022-09-27 26f5dd8ef80e5671cda8fc0e6c0d0298c4e678ff
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
package com.iplatform.recvideo;
 
import com.walker.infrastructure.utils.NumberFormatUtils;
 
public class SimilarVideoUser implements Comparable<SimilarVideoUser>{
 
    private long userId;
    private String recommendVideoId;
 
    private double score = 0;
 
    // 这个相似视频,对应的源视频图像张数
    private int count = 0;
 
    public SimilarVideoUser(long userId, String recommendVideoId){
        this.userId = userId;
        this.recommendVideoId = recommendVideoId;
    }
 
    public void increase(){
        this.count ++;
    }
 
    public void setScore(double totalScore){
        this.score = totalScore;
    }
 
    public long getUserId() {
        return userId;
    }
 
    public String getRecommendVideoId() {
        return recommendVideoId;
    }
 
    public double getScore() {
        return NumberFormatUtils.scaleAccuracy2(this.score);
    }
 
    @Override
    public String toString(){
        return new StringBuilder("[recVideoId=").append(this.recommendVideoId)
                .append(", score=").append(this.score)
                .append("]").toString();
    }
 
    @Override
    public int hashCode(){
        return this.recommendVideoId.hashCode();
    }
 
    @Override
    public boolean equals(Object obj){
        if(obj == null){
            return false;
        }
        if(obj instanceof SimilarVideoUser){
            SimilarVideoUser e = (SimilarVideoUser)obj;
            if(e.recommendVideoId.equals(this.recommendVideoId)){
                return true;
            }
        }
        return false;
    }
 
    @Override
    public int compareTo(SimilarVideoUser o) {
        return o.count - this.count;
    }
}