Package ortus.boxlang.runtime.operators
Class Compare
java.lang.Object
ortus.boxlang.runtime.operators.Compare
- All Implemented Interfaces:
IOperator
Performs EQ, GT, and LT comparisons
Compares numbers as numbers, compares strings case insensitive
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic booleanFlag to allow compat to set the comparison mode for dates to loose -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
lenientDateComparison
public static boolean lenientDateComparisonFlag to allow compat to set the comparison mode for dates to loose
-
-
Constructor Details
-
Compare
public Compare()
-
-
Method Details
-
invoke
Invokes the comparison- Parameters:
left- The left operandright- The right operand- Returns:
- 1 if greater than, -1 if less than, = if equal
-
invoke
Invokes the comparison- Parameters:
left- The left operandright- The right operandcaseSensitive- Whether to compare strings case sensitive- Returns:
- 1 if greater than, -1 if less than, = if equal
-
attempt
Invokes the comparison- Parameters:
left- The left operandright- The right operandcaseSensitive- Whether to compare strings case sensitivefail- True to throw an exception if the left and right arguments cannot be compared- Returns:
- 1 if greater than, -1 if less than, 0 if equal
-
attempt
Invokes the comparison- Parameters:
left- The left operandright- The right operandcaseSensitive- Whether to compare strings case sensitivelocale- The locale to use for comparison- Returns:
- 1 if greater than, -1 if less than, 0 if equal
-
invoke
public static Integer invoke(Object left, Object right, boolean caseSensitive, boolean fail, Locale locale) Invokes the comparison- Parameters:
left- The left operandright- The right operandcaseSensitive- Whether to compare strings case sensitive *fail- True to throw an exception if the left and right arguments cannot be comparedlocale- The locale to use for comparison- Returns:
- 1 if greater than, -1 if less than, 0 if equal. Null if fail=false and the left and right arguments cannot be compared
-