package com.apobates.forum.core;

import com.apobates.forum.core.entity.Topic;
import java.io.Serializable;

/**
 * 话题相关记录结果封装
 * @author xiaofanku
 * @since 20200522
 */
public class TagRelateTopic implements Serializable, Comparable<TagRelateTopic>{
    private static final long serialVersionUID = 3101501005271044195L;
    private final Topic topic;
    //显示的顺序,小的先显示
    private final int ranking;
    //相似度
    private final double similarity;
    
    public TagRelateTopic(Topic topic, int ranking, double similarity) {
        super();
        this.topic = topic;
        this.ranking = ranking;
        this.similarity = similarity;
    }
    
    public Topic getTopic() {
        return topic;
    }
    
    public int getRanking() {
        return ranking;
    }
    
    public double getSimilarity() {
        return similarity;
    }
    
    @Override
    public int compareTo(TagRelateTopic o) {
        return ranking - o.getRanking();
    }
}