pair.java

来自「本算法是实现基于KNN的基因遗传算法」· Java 代码 · 共 41 行

JAVA
41
字号
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package gaknn.core;/** * * @author Niro */public class Pair implements Comparable{    public Pair(int i,double v){        index=i;        value=v;    }        int index;     double value;	       public int Index(){        return index;    }        public double Value(){        return value;    }	       public int compareTo(Object pair) throws ClassCastException {        if ((((Pair) pair).value) > this.value)            return 1;        else if ((((Pair) pair).value) == this.value)            return 0;        else            return -1;    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?