package com.tzld.piaoquan.recommend.server.framework.candidiate;


import java.util.HashMap;
import java.util.Map;

/**
 * 一个队列召回的内容实体
 * @param <T>
 */
public class Entry<T> {
    public final String id;
    public final T item;
    public final Map<String, Double> scores;
    public final Map<String, String> explanations;


    public Entry(T item, String id) {
        this.item = item;
        this.id = id;
        this.scores = new HashMap<String, Double>();
        this.explanations = new HashMap<String, String>();
    }

    public Entry(Entry<T> other) {
        this.item = other.item;
        this.id = other.id;
        this.scores = other.scores;
        this.explanations = other.explanations;
    }

    public void addScore(String name, double score) {
        scores.put(name, score);
    }

    public void addExplanation(String name, String explanation) {
        explanations.put(name, explanation);
    }
}
