package clothSimulator;

import java.util.Comparator;

public class ConstraintEdgeComparator implements Comparator<ConstraintGraphNode>{

	@Override
	public int compare(ConstraintGraphNode n1, ConstraintGraphNode n2) {

		// TODO must return -1 if n1<n2, returns 0 if n1=n2, returns +1 if n1>n2
		
		
//testing
//		if((n1.p.getIndex()==5 && n2.p.getIndex()==4) || (n1.p.getIndex()==4 && n2.p.getIndex()==5) ){
//			System.out.println("picked pair");
//		}
//		if(n1.p.getIndex()==5||n2.p.getIndex()==5){
//			System.out.println("picked one");
//		}
		
		if (n1.primKey.compareTo(n2.primKey) <0 ){
			return -1;
		} else if (n1.primKey.compareTo(n2.primKey) == 0) {
			return 0;
		}
		return 1;

		//search through the branches of n1 and compare to the branches of n2
	}

}
