Class Expressions
java.lang.Object
ch.andre601.expressionparser.expressions.Expressions
Class containing a collection of pre-made methods to perform certain operations with.
All methods return a ToXExpression class.
All methods return a ToXExpression class.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic ToBooleanExpression
and
(Collection<ToBooleanExpression> operands) Returns aToBooleanExpression
who's boolean value is true if and only if all provided ToBooleanExpressions have a true boolean value.static ToStringExpression
concat
(Collection<ToStringExpression> operands) Returns aToStringExpression
who's String value is the concatenated (merged) String values of all provided ToStringExpressions.static ToBooleanExpression
Returns aToBooleanExpression
who's boolean value is true if the String value of the firstToStringExpression
contains the String value of the secondToStringExpression
.static ToDoubleExpression
Returns aToDoubleExpression
who's double value is the double value of the first ToDoubleExpression divided by the double value of the second ToDoubleExpression.static ToBooleanExpression
Returns aToBooleanExpression
who's boolean value is true if the String value of the firstToStringExpression
ends with the String value of the secondToStringExpression
.static ToBooleanExpression
Returns aToBooleanExpression
who's boolean value is true if and only if the String values of both providedToStringExpressions
are equal.static ToBooleanExpression
Returns aToBooleanExpression
who's boolean value is true if and only if the String values of both providedToStringExpressions
are equal.static ToBooleanExpression
Returns aToBooleanExpression
who's boolean value is true if the double value of the firstToDoubleExpression
is greater than or equal to the double value of the secondToDoubleExpression
.static ToBooleanExpression
Returns aToBooleanExpression
who's boolean value is true if the double value of the firstToDoubleExpression
is greater than the double value of the secondToDoubleExpression
.static ToBooleanExpression
Returns aToBooleanExpression
who's boolean value is true if the double value of the firstToDoubleExpression
is less than or equal to the double value of the secondToDoubleExpression
.static ToBooleanExpression
Returns aToBooleanExpression
who's boolean value is true if the double value of the firstToDoubleExpression
is less than the double value of the secondToDoubleExpression
.static ToBooleanExpression
negate
(ToBooleanExpression expression) Negates the providedToBooleanExpression
.static ToDoubleExpression
Negates the providedToDoubleExpression's
double value.static ToBooleanExpression
Returns aToBooleanExpression
who's boolean value is true if and only if the String values of both providedToStringExpressions
are not equal.static ToBooleanExpression
Returns aToBooleanExpression
who's boolean value is true if and only if the String values of both providedToStringExpressions
are not equal.static ToBooleanExpression
or
(Collection<ToBooleanExpression> operands) Returns aToBooleanExpression
who's boolean value is true if at least one of the provided ToBooleanExpressions has a true boolean value.static ToDoubleExpression
product
(Collection<ToDoubleExpression> operands) Returns aToDoubleExpression
who's double value is the product of all double values from the provided ToDoubleExpressions.static ToBooleanExpression
Returns aToBooleanExpression
who's boolean value is true if the String value of the firstToStringExpression
starts with the String value of the secondToStringExpression
.static ToDoubleExpression
Returns aToDoubleExpression
who's double value is the double value of the first ToDoubleExpression minus the double value of the second ToDoubleExpression.static ToDoubleExpression
sum
(Collection<ToDoubleExpression> operands) Returns aToDoubleExpression
who's double value is the sum of the double values of all provided ToDoubleExpressions.
-
Constructor Details
-
Expressions
public Expressions()
-
-
Method Details
-
negate
Negates the providedToBooleanExpression
.- Parameters:
expression
- The ToBooleanExpression to negate.- Returns:
- ToBooleanExpression with its boolean value negated.
-
and
Returns aToBooleanExpression
who's boolean value is true if and only if all provided ToBooleanExpressions have a true boolean value.- Parameters:
operands
- Collection of ToBooleanExpressions to AND together.- Returns:
- ToBooleanExpression with boolean value being true if and only if all provided ToBooleanExpressions have a true boolean value.
-
or
Returns aToBooleanExpression
who's boolean value is true if at least one of the provided ToBooleanExpressions has a true boolean value.- Parameters:
operands
- Collection of ToBooleanExpressions to OR together.- Returns:
- ToBooleanExpression with boolean value being true if at least one of the provided ToBooleanExpressions has a true boolean value.
-
concat
Returns aToStringExpression
who's String value is the concatenated (merged) String values of all provided ToStringExpressions.- Parameters:
operands
- Collection of ToStringExpressions to concatenate the String values of.- Returns:
- ToStringExpression with String value being the concatenated (merged) String values of the provided ToStringExpression's String values.
-
equal
Returns aToBooleanExpression
who's boolean value is true if and only if the String values of both providedToStringExpressions
are equal.
This method is case-sensitive. For a case-insensitive option seeequalIgnoreCase(ToStringExpression, ToStringExpression)
.- Parameters:
a
- First ToStringExpression to use.b
- Second ToStringExpression to compare with.- Returns:
- ToBooleanExpression who's boolean value is true if and only if the String values of both provided ToStringExpressions are equal, including case.
- See Also:
-
equalIgnoreCase
Returns aToBooleanExpression
who's boolean value is true if and only if the String values of both providedToStringExpressions
are equal.
This method is case-insensitive. For a case-sensitive option seeequal(ToStringExpression, ToStringExpression)
.- Parameters:
a
- First ToStringExpression to use.b
- Second ToStringExpression to compare with.- Returns:
- ToBooleanExpression who's boolean value is true if and only if the String values of both provided ToStringExpressions are equal, including case.
-
notEqual
Returns aToBooleanExpression
who's boolean value is true if and only if the String values of both providedToStringExpressions
are not equal.
This method is case-sensitive. For a case-insensitive option seenotEqualIgnoreCase(ToStringExpression, ToStringExpression)
.- Parameters:
a
- First ToStringExpression to use.b
- Second ToStringExpression to compare with.- Returns:
- ToBooleanExpression who's boolean value is true if and only if the String values of both provided ToStringExpression are not equal, including case.
-
notEqualIgnoreCase
Returns aToBooleanExpression
who's boolean value is true if and only if the String values of both providedToStringExpressions
are not equal.
This method is case-sensitive. For a case-insensitive option seenotEqual(ToStringExpression, ToStringExpression)
.- Parameters:
a
- First ToStringExpression to use.b
- Second ToStringExpression to compare with.- Returns:
- ToBooleanExpression who's boolean value is true if and only if the String values of both provided ToStringExpression are not equal, including case.
-
startsWith
Returns aToBooleanExpression
who's boolean value is true if the String value of the firstToStringExpression
starts with the String value of the secondToStringExpression
.- Parameters:
a
- First ToStringExpression to do a check for.b
- Second ToStringExpression to check if first starts with.- Returns:
- ToBooleanExpression who's boolean value is true if the String value of the first ToStringExpression starts with the String value of the second ToStringExpression.
-
endsWith
Returns aToBooleanExpression
who's boolean value is true if the String value of the firstToStringExpression
ends with the String value of the secondToStringExpression
.- Parameters:
a
- First ToStringExpression to do a check for.b
- Second ToStringExpression to check if first ends with.- Returns:
- ToBooleanExpression who's boolean value is true if the String value of the first ToStringExpression ends with the String value of the second ToStringExpression.
-
contains
Returns aToBooleanExpression
who's boolean value is true if the String value of the firstToStringExpression
contains the String value of the secondToStringExpression
.- Parameters:
a
- First ToStringExpression to do a check for.b
- Second ToStringExpression to check if first contains it.- Returns:
- ToBooleanExpression who's boolean value is true if the String value of the first ToStringExpression contains the String value of the second ToStringExpression.
-
greaterThan
Returns aToBooleanExpression
who's boolean value is true if the double value of the firstToDoubleExpression
is greater than the double value of the secondToDoubleExpression
.- Parameters:
a
- The first ToDoubleExpression to do a check with.b
- The second ToDoubleExpression to do a check with.- Returns:
- ToBooleanExpression who's boolean value is true if the double value of the first ToDoubleExpression is greater than the double value of the second ToDoubleExpression.
-
greaterOrEqualThan
Returns aToBooleanExpression
who's boolean value is true if the double value of the firstToDoubleExpression
is greater than or equal to the double value of the secondToDoubleExpression
.- Parameters:
a
- The first ToDoubleExpression to do a check with.b
- The second ToDoubleExpression to do a check with.- Returns:
- ToBooleanExpression who's boolean value is true if the double value of the first ToDoubleExpression is greater than or equal to the double value of the second ToDoubleExpression.
-
lessThan
Returns aToBooleanExpression
who's boolean value is true if the double value of the firstToDoubleExpression
is less than the double value of the secondToDoubleExpression
.- Parameters:
a
- The first ToDoubleExpression to do a check with.b
- The second ToDoubleExpression to do a check with.- Returns:
- ToBooleanExpression who's boolean value is true if the double value of the first ToDoubleExpression is less than the double value of the second ToDoubleExpression.
-
lessOrEqualThan
Returns aToBooleanExpression
who's boolean value is true if the double value of the firstToDoubleExpression
is less than or equal to the double value of the secondToDoubleExpression
.- Parameters:
a
- The first ToDoubleExpression to do a check with.b
- The second ToDoubleExpression to do a check with.- Returns:
- ToBooleanExpression who's boolean value is true if the double value of the first ToDoubleExpression is less than or equal to the double value of the second ToDoubleExpression.
-
sum
Returns aToDoubleExpression
who's double value is the sum of the double values of all provided ToDoubleExpressions.- Parameters:
operands
- Collection of ToDoubleExpression to sum.- Returns:
- ToDoubleExpression who's double value is the sum of all double values of the provided ToDoubleExpressions.
-
product
Returns aToDoubleExpression
who's double value is the product of all double values from the provided ToDoubleExpressions.- Parameters:
operands
- Collection of ToDoubleExpressions to multiply.- Returns:
- ToDoubleExpression who's double value is the product of all double values from the provided ToDoubleExpression.
-
sub
Returns aToDoubleExpression
who's double value is the double value of the first ToDoubleExpression minus the double value of the second ToDoubleExpression.- Parameters:
a
- First ToDoubleExpression who's double value to use.b
- Second ToDoubleExpression who's double value to subtract from the first ToDoubleExpression's double value.- Returns:
- ToDoubleExpression who's double value is the double value of the first ToDoubleExpression minus the double value of the second ToDoubleExpression.
-
div
Returns aToDoubleExpression
who's double value is the double value of the first ToDoubleExpression divided by the double value of the second ToDoubleExpression.- Parameters:
a
- First ToDoubleExpression who's double value to use.b
- Second ToDoubleExpression who's double value to divide the double value of the first ToDoubleExpression with.- Returns:
- ToDoubleExpression who's double value is the double value of the first ToDoubleExpression divided by the double value of the second ToDoubleExpression.
-
negateNumber
Negates the providedToDoubleExpression's
double value.- Parameters:
a
- The ToDoubleExpression to negate the double value of.- Returns:
- ToDoubleExpression who's double value has been negated.
-