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;
|
}
|
}
|