Coverage Report - org.kuali.rice.krms.framework.engine.ComparisonOperator
 
Classes in this File Line Coverage Branch Coverage Complexity
ComparisonOperator
71%
15/21
37%
9/24
14
 
 1  
 package org.kuali.rice.krms.framework.engine;
 2  
 
 3  7
 public enum ComparisonOperator {
 4  
 
 5  1
         EQUALS,
 6  1
         NOT_EQUALS,
 7  1
         GREATER_THAN,
 8  1
         GREATER_THAN_EQUAL,
 9  1
         LESS_THAN,
 10  1
         LESS_THAN_EQUAL;
 11  
         
 12  
         public <T> boolean compare(Comparable<T> lhs, T rhs) {
 13  40
                 int result = lhs.compareTo(rhs);
 14  40
                 if (this == EQUALS) {
 15  0
                         return result == 0;
 16  
                 }
 17  40
                 if (this == NOT_EQUALS) {
 18  0
                         return result != 0;
 19  
                 }
 20  40
                 if (this == GREATER_THAN) {
 21  39
                         return result > 0;
 22  
                 }
 23  1
                 if (this == GREATER_THAN_EQUAL) {
 24  0
                         return result >= 0;
 25  
                 }
 26  1
                 if (this == LESS_THAN) {
 27  1
                         return result < 0;
 28  
                 }
 29  0
                 if (this == LESS_THAN_EQUAL) {
 30  0
                         return result <= 0;
 31  
                 }
 32  0
                 throw new IllegalStateException("Invalid operator detected: " + this);
 33  
         }
 34  
         
 35  
         
 36  
 }