001 package railo.runtime.util; 002 003 import java.util.Date; 004 005 import railo.runtime.exp.PageException; 006 007 /** 008 * class to compare objects and primitive value types 009 */ 010 public interface Operation { 011 012 /** 013 * compares two Objects 014 * @param left 015 * @param right 016 * @return different of objects as int 017 * @throws PageException 018 */ 019 public int compare(Object left, Object right) throws PageException; 020 021 /** 022 * compares a Object with a String 023 * @param left 024 * @param right 025 * @return difference as int 026 * @throws PageException 027 */ 028 public int compare(Object left, String right) throws PageException ; 029 030 /** 031 * compares a Object with a double 032 * @param left 033 * @param right 034 * @return difference as int 035 * @throws PageException 036 */ 037 public int compare(Object left, double right) throws PageException; 038 039 /** 040 * compares a Object with a boolean 041 * @param left 042 * @param right 043 * @return difference as int 044 * @throws PageException 045 */ 046 public int compare(Object left, boolean right) throws PageException; 047 048 /** 049 * compares a Object with a Date 050 * @param left 051 * @param right 052 * @return difference as int 053 * @throws PageException 054 */ 055 public int compare(Object left, Date right) throws PageException; 056 057 /** 058 * compares a String with a Object 059 * @param left 060 * @param right 061 * @return difference as int 062 * @throws PageException 063 */ 064 public int compare(String left, Object right) throws PageException; 065 066 /** 067 * compares a String with a String 068 * @param left 069 * @param right 070 * @return difference as int 071 */ 072 public int compare(String left, String right); 073 074 /** 075 * compares a String with a double 076 * @param left 077 * @param right 078 * @return difference as int 079 */ 080 public int compare(String left, double right); 081 082 /** 083 * compares a String with a boolean 084 * @param left 085 * @param right 086 * @return difference as int 087 */ 088 public int compare(String left, boolean right); 089 090 /** 091 * compares a String with a Date 092 * @param left 093 * @param right 094 * @return difference as int 095 * @throws PageException 096 */ 097 public int compare(String left, Date right) throws PageException; 098 099 /** 100 * compares a double with a Object 101 * @param left 102 * @param right 103 * @return difference as int 104 * @throws PageException 105 */ 106 public int compare(double left, Object right) throws PageException; 107 108 /** 109 * compares a double with a String 110 * @param left 111 * @param right 112 * @return difference as int 113 */ 114 public int compare(double left, String right); 115 116 /** 117 * compares a double with a double 118 * @param left 119 * @param right 120 * @return difference as int 121 */ 122 public int compare(double left, double right); 123 124 /** 125 * compares a double with a boolean 126 * @param left 127 * @param right 128 * @return difference as int 129 */ 130 public int compare(double left, boolean right); 131 132 /** 133 * compares a double with a Date 134 * @param left 135 * @param right 136 * @return difference as int 137 */ 138 public int compare(double left, Date right); 139 140 /** 141 * compares a boolean with a Object 142 * @param left 143 * @param right 144 * @return difference as int 145 * @throws PageException 146 */ 147 public int compare(boolean left, Object right) throws PageException; 148 149 /** 150 * compares a boolean with a double 151 * @param left 152 * @param right 153 * @return difference as int 154 */ 155 public int compare(boolean left, double right); 156 157 /** 158 * compares a boolean with a double 159 * @param left 160 * @param right 161 * @return difference as int 162 */ 163 public int compare(boolean left, String right); 164 165 /** 166 * compares a boolean with a boolean 167 * @param left 168 * @param right 169 * @return difference as int 170 */ 171 public int compare(boolean left, boolean right); 172 173 /** 174 * compares a boolean with a Date 175 * @param left 176 * @param right 177 * @return difference as int 178 */ 179 public int compare(boolean left, Date right); 180 181 /** 182 * compares a Date with a Object 183 * @param left 184 * @param right 185 * @return difference as int 186 * @throws PageException 187 */ 188 public int compare(Date left, Object right) throws PageException; 189 190 /** 191 * compares a Date with a String 192 * @param left 193 * @param right 194 * @return difference as int 195 * @throws PageException 196 */ 197 public int compare(Date left, String right) throws PageException; 198 199 /** 200 * compares a Date with a double 201 * @param left 202 * @param right 203 * @return difference as int 204 */ 205 public int compare(Date left, double right); 206 207 /** 208 * compares a Date with a boolean 209 * @param left 210 * @param right 211 * @return difference as int 212 */ 213 public int compare(Date left, boolean right); 214 215 /** 216 * compares a Date with a Date 217 * @param left 218 * @param right 219 * @return difference as int 220 */ 221 public int compare(Date left, Date right); 222 223 /** 224 * Method to compare to different values, return true of objects are same otherwise false 225 * @param left left value to compare 226 * @param right right value to compare 227 * @param caseSensitive check case sensitive or not 228 * @return is same or not 229 * @throws PageException 230 */ 231 public boolean equals(Object left, Object right, boolean caseSensitive) throws PageException; 232 233 /** 234 * check if left is inside right (String-> ignore case) 235 * @param left string to check 236 * @param right substring to find in string 237 * @return return if substring has been found 238 * @throws PageException 239 */ 240 public boolean ct(Object left, Object right) throws PageException; 241 242 /** 243 * Equivalence: Return True if both operands are True or both are False. The EQV operator is the opposite of the XOR operator. For example, True EQV True is True, but True EQV False is False. 244 * @param left value to check 245 * @param right value to check 246 * @return result of operation 247 * @throws PageException 248 */ 249 public boolean eqv(Object left, Object right) throws PageException; 250 251 /** 252 * Implication: The statement A IMP B is the equivalent of the logical statement 253 * "If A Then B." A IMP B is False only if A is True and B is False. It is True in all other cases. 254 * @param left value to check 255 * @param right value to check 256 * @return result 257 * @throws PageException 258 */ 259 public boolean imp(Object left, Object right) throws PageException; 260 261 /** 262 * check if left is not inside right (String-> ignore case) 263 * @param left string to check 264 * @param right substring to find in string 265 * @return return if substring NOT has been found 266 * @throws PageException 267 */ 268 public boolean nct(Object left, Object right) throws PageException; 269 270 /** 271 * calculate the exponent of the left value 272 * @param left value to get exponent from 273 * @param right exponent count 274 * @return return expoinended value 275 * @throws PageException 276 */ 277 public double exponent(Object left, Object right) throws PageException; 278 279 280 /** 281 * concat to Strings 282 * @param left 283 * @param right 284 * @return concated String 285 */ 286 public String concat(String left,String right); 287 288 /** 289 * plus operation 290 * @param left 291 * @param right 292 * @return result of the opertions 293 */ 294 public double plus(double left, double right); 295 296 /** 297 * minus operation 298 * @param left 299 * @param right 300 * @return result of the opertions 301 */ 302 public double minus(double left, double right); 303 304 /** 305 * modulus operation 306 * @param left 307 * @param right 308 * @return result of the opertions 309 */ 310 public double modulus(double left, double right); 311 312 /** 313 * divide operation 314 * @param left 315 * @param right 316 * @return result of the opertions 317 */ 318 public double divide(double left, double right); 319 320 /** 321 * multiply operation 322 * @param left 323 * @param right 324 * @return result of the opertions 325 */ 326 public double multiply(double left, double right); 327 }