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();
}
}
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();
}
}
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?
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());