1 /** 2 * Copyright 2005-2011 The Kuali Foundation 3 * 4 * Licensed under the Educational Community License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.opensource.org/licenses/ecl2.php 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.kuali.rice.krms.test; 17 18 import org.kuali.rice.krms.framework.engine.expression.EngineComparatorExtension; 19 20 /** 21 * 22 * Used for testing the ComparisonOperatorService 23 * 24 * @link ComparisonOperatorService 25 * @author Kuali Rice Team (rice.collab@kuali.org) 26 */ 27 public class CustomComparisonOperator implements EngineComparatorExtension { 28 @Override 29 public int compare(Object lhs, Object rhs) { 30 if (lhs.equals(rhs)) { 31 return 0; 32 } 33 return lhs.toString().compareTo(rhs.toString()); 34 } 35 36 @Override 37 public boolean canCompare(Object lhs, Object rhs) { 38 return (lhs instanceof CustomComparisonOperator && rhs instanceof CustomComparisonOperator); 39 } 40 }