CompareFactory.java 596 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
package cn.timer.api.utils.router;

public class CompareFactory{

	public static Compare createCompare(String strA, String strB, String compare) {
		Compare comp = null;
		
		switch (compare) {
		case "<":
			comp = new LtCompare(strA,strB);
			break;
		case "<=":
			comp = new LtOREqualCompare(strA,strB);
			break;
		case "=":
			comp = new EqualCompare(strA,strB);
			break;
		case ">":
			comp = new GtCompare(strA,strB);
			break;
		case ">=":
			comp = new GtOREqualCompare(strA,strB);
			break;
		default :
			comp = new EqualCompare(strA,strB);
			break;
		}
		
		return comp;
		
	}
	
}