Coverage Report - org.apache.commons.el.RelationalOperator
 
Classes in this File Line Coverage Branch Coverage Complexity
RelationalOperator
0%
0/11
0%
0/6
1.667
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 3  
  * contributor license agreements.  See the NOTICE file distributed with
 4  
  * this work for additional information regarding copyright ownership.
 5  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 6  
  * (the "License"); you may not use this file except in compliance with
 7  
  * the License.  You may obtain a copy of the License at
 8  
  *
 9  
  *     http://www.apache.org/licenses/LICENSE-2.0
 10  
  *
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 package org.apache.commons.el;
 18  
 
 19  
 import java.math.BigDecimal;
 20  
 import java.math.BigInteger;
 21  
 
 22  
 import javax.servlet.jsp.el.ELException;
 23  
 
 24  
 /**
 25  
  *
 26  
  * <p>This is the superclass for all relational operators (except ==
 27  
  * or !=)
 28  
  * 
 29  
  * @author Nathan Abramson - Art Technology Group
 30  
  * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: bayard $
 31  
  **/
 32  
 
 33  0
 public abstract class RelationalOperator
 34  
   extends BinaryOperator
 35  
 {
 36  
 
 37  
   //-------------------------------------
 38  
   /**
 39  
    *
 40  
    * Applies the operator to the given value
 41  
    **/
 42  
   public Object apply (Object pLeft, Object pRight)
 43  
     throws ELException
 44  
   {
 45  0
     return Coercions.applyRelationalOperator (pLeft, pRight, this);
 46  
   }
 47  
 
 48  
   //-------------------------------------
 49  
   /**
 50  
    *
 51  
    * Applies the operator to the given double values
 52  
    **/
 53  
   public abstract boolean apply (double pLeft,
 54  
                                  double pRight
 55  
                                  );
 56  
   
 57  
   //-------------------------------------
 58  
   /**
 59  
    *
 60  
    * Applies the operator to the given long values
 61  
    **/
 62  
   public abstract boolean apply (long pLeft,
 63  
                                  long pRight
 64  
                                  );
 65  
   
 66  
   //-------------------------------------
 67  
   /**
 68  
    *
 69  
    * Applies the operator to the given String values
 70  
    **/
 71  
   public abstract boolean apply (String pLeft,
 72  
                                  String pRight
 73  
                                  );
 74  
 
 75  
   //-------------------------------------
 76  
 
 77  
 
 78  
     /**
 79  
      * Applies the operator to the given BigDecimal values, returning a BigDecimal
 80  
      **/
 81  
     public abstract boolean apply(BigDecimal pLeft, BigDecimal pRight);
 82  
 
 83  
     //-------------------------------------
 84  
 
 85  
     /**
 86  
      * Applies the operator to the given BigDecimal values, returning a BigDecimal
 87  
      **/
 88  
     public abstract boolean apply(BigInteger pLeft, BigInteger pRight);
 89  
 
 90  
     //-------------------------------------
 91  
 
 92  
 
 93  
     /**
 94  
      * Test return value of BigInteger/BigDecimal A.compareTo(B).
 95  
      * @param val - result of BigInteger/BigDecimal compareTo() call
 96  
      * @return - true if result is less than 0, otherwise false
 97  
      */
 98  
     protected boolean isLess(int val) {
 99  0
         if (val < 0)
 100  0
             return true;
 101  
         else
 102  0
             return false;
 103  
     }
 104  
 
 105  
     /**
 106  
      * Test return value of BigInteger/BigDecimal A.compareTo(B).
 107  
      * @param val - result of BigInteger/BigDecimal compareTo() call
 108  
      * @return - true if result is equal to 0, otherwise false
 109  
      */
 110  
     protected boolean isEqual(int val) {
 111  0
         if (val == 0)
 112  0
             return true;
 113  
         else
 114  0
             return false;
 115  
     }
 116  
 
 117  
     /**
 118  
      * Test return value of BigInteger/BigDecimal A.compareTo(B).
 119  
      * @param val - result of BigInteger/BigDecimal compareTo() call
 120  
      * @return - true if result is greater than 0, otherwise false
 121  
      */
 122  
     protected boolean isGreater(int val) {
 123  0
         if (val > 0)
 124  0
             return true;
 125  
         else
 126  0
             return false;
 127  
     }
 128  
 }