public static boolean equals(VariableScope variableScope, String variableName, Object comparedValue) { Object variableValue = getVariableValue(variableScope, variableName); if (comparedValue != null && variableValue != null) { if (valuesAreNumbers(comparedValue, variableValue)) { if (variableValue instanceof Long) { return ((Number) variableValue).longValue() == ((Number) comparedValue).longValue(); return defaultEquals(comparedValue, variableValue);
public static boolean notEquals(VariableScope variableScope, String variableName, Object variableValue) { // Special handling for null: when the variable is null, false is returned. // This is similar to equals, where a null variable value will always return false // (it's effectively ignored) - unless it's compared to null itself) Object actualValue = getVariableValue(variableScope, variableName); if (actualValue != null) { return !VariableEqualsExpressionFunction.equals(variableScope, variableName, variableValue); } return false; } }
public void initShortHandExpressionFunctions() { if (shortHandExpressionFunctions == null) { shortHandExpressionFunctions = new ArrayList<>(); String variableScopeName = "execution"; shortHandExpressionFunctions.add(new VariableGetExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableGetOrDefaultExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableContainsAnyExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableContainsExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableEqualsExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableNotEqualsExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableExistsExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableIsEmptyExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableIsNotEmptyExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableLowerThanExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableLowerThanOrEqualsExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableGreaterThanExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableGreaterThanOrEqualsExpressionFunction(variableScopeName)); } }
public void initShortHandExpressionFunctions() { if (shortHandExpressionFunctions == null) { shortHandExpressionFunctions = new ArrayList<>(); String variableScopeName = "planItemInstance"; shortHandExpressionFunctions.add(new VariableGetExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableGetOrDefaultExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableContainsAnyExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableContainsExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableEqualsExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableNotEqualsExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableExistsExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableIsEmptyExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableIsNotEmptyExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableLowerThanExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableLowerThanOrEqualsExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableGreaterThanExpressionFunction(variableScopeName)); shortHandExpressionFunctions.add(new VariableGreaterThanOrEqualsExpressionFunction(variableScopeName)); } }