javac -Xlint *.java
waring:[unchecked] unchecked conversion
found PQcomparator
require:java.utill.Comparator<? super node>
bestSucc = new PriorityQueue<node>(1,new PQComparator());
1 warningmy PQComparator class is:
import java.util.Comparator;
class PQComparator implements Comparator{
node t1;
node t2;
public int compare(Object a,Object b){
t1= (node)a;
t2= (node)b;
return t1.getNum()-t2.getNum();
}
}

解决方案 »

  1.   

    another simple question is:
    int[] caluse = new int[3];
    ArrayList<int[]> formula = new ArrayList<int[]>();
    formula.add(caluse);
    but the formula ArrayList only check the item add into it is a int[] while i want to give a restrict add with every item must be int[3];
    like ArrayList<int[3]> formula = new ArrayList<int[]>();
    but it does not work;
    instead create a class like caluseNode{
        int a = new int[3];
    }
    and do the following declare:
    ArrayList<caluseNode> formula = new ArrayList<int[]>();
    is there any other solutions?
      

  2.   

    我用netBeans 5.0 beta,单独编译PQComparator没有出现警告。不知道bestSucc = new PriorityQueue<node>(1,new PQComparator());是哪个类的,是否与调用有关呢。
      

  3.   

    just in my code like following:
    public class test{
    Random rand;
    int nVars; //the number of propositional variables
    int nCals; //the number of clauses
    int[] symbolPool; //all the variables strore in this array
    int[] caluse = new int[3];
    ArrayList<int[]> formula;
    ArrayList<node> nodeList;
    int max_restarts;
    int max_climbs;
    private  PriorityQueue<node> bestSucc;
    private  PriorityQueue<node> bestSuccTemp;

    test(){
    bestSucc = new PriorityQueue<node>(1,new PQComparator());
    formula = new ArrayList<int[]>();
    nodeList = new ArrayList<node>();
    rand = new Random();
    nVars = 100;
    nCals = 100;
    max_restarts = 100;
    max_climbs = 500;
    }
    ....................
    with the line new PriorityQueue<node>(1,new PQComparator());
      

  4.   

    这是个泛型的问题.泛型是J2SE 5.0最重要的特性。关于这个在我的Blog里有详细的介绍,建议你去看一下就全明白了.地址是:http://blog.csdn.net/zhouyong80/archive/2005/10/26/517076.aspx