1 55 56 package org.apache.commons.el; 57 58 import javax.servlet.jsp.el.ELException ; 59 import java.math.BigDecimal ; 60 import java.math.BigInteger ; 61 62 69 70 public class GreaterThanOperator 71 extends RelationalOperator 72 { 73 77 public static final GreaterThanOperator SINGLETON = 78 new GreaterThanOperator (); 79 80 85 public GreaterThanOperator () 86 { 87 } 88 89 96 public String getOperatorSymbol () 97 { 98 return ">"; 99 } 100 101 106 public Object apply (Object pLeft, 107 Object pRight, 108 Logger pLogger) 109 throws ELException 110 { 111 if (pLeft == pRight) { 112 return Boolean.FALSE; 113 } 114 else if (pLeft == null || 115 pRight == null) { 116 return Boolean.FALSE; 117 } 118 else { 119 return super.apply (pLeft, pRight, pLogger); 120 } 121 } 122 123 128 public boolean apply (double pLeft, double pRight) { 129 return pLeft > pRight; 130 } 131 132 137 public boolean apply (long pLeft, long pRight) { 138 return pLeft > pRight; 139 } 140 141 146 public boolean apply (String pLeft, String pRight) { 147 return pLeft.compareTo (pRight) > 0; 148 } 149 150 152 156 public boolean apply(BigDecimal pLeft, BigDecimal pRight) { 157 return isGreater(pLeft.compareTo(pRight)); 158 } 159 160 162 166 public boolean apply(BigInteger pLeft, BigInteger pRight) { 167 return isGreater(pLeft.compareTo(pRight)); 168 } 169 170 } 172 | Popular Tags |