<span style="font-size:24px;">public interface Scoreable extends Data
此为接口,任何能根据一个data进行打分的对象(类)都必须要实现此接口。此接口代表了一个可以被打分的对象。
本接口有一个内部类对象为:
Comparator<Scoreable> COMPARATOR ;此对象内有个int compare(Scoreable t1, Scoreable t2)方法,用来实现对两个可打分对象进行比较。如t1的得分大于 t2的得分返回为-1,t1的得分等于 t2的得分返回为0,t1的得分小于 t2的得分返回为1。
此对象即comparator 根据可打分对象的得分来对其进行排序,是逆序排序的,即由大到小排序。注意一个高得分会导致一个低的自然排序,statements状态如Collections.min(list, Scoreable.COMPARATOR)通过会返回有着最高得分的Scoreable对象,Collections.min中的min与一般意义上的min的意思是相反的。
本接口的方法:
public float calculateScore(Data data);根据给定的data来计算Scoreable对象的得分。
public float getScore();得到计算出来Scoreable的得分或已经规格化的得分。
public float normalizeScore(float maxScore);对一个已经计算出来的得分进行规格化处理。
public int getFrameNumber();返回的是根据data进行打分的Scoreable的那个相应的data的帧数即FrameNumber。</span>
Scoreable API 可打分
最新推荐文章于 2019-12-09 18:30:00 发布