Class Expressions

java.lang.Object
ch.andre601.expressionparser.expressions.Expressions

public class Expressions extends Object
Class containing a collection of pre-made methods to perform certain operations with.
All methods return a ToXExpression class.
  • Constructor Details

    • Expressions

      public Expressions()
  • Method Details

    • negate

      public static ToBooleanExpression negate(ToBooleanExpression expression)
      Negates the provided ToBooleanExpression.
      Parameters:
      expression - The ToBooleanExpression to negate.
      Returns:
      ToBooleanExpression with its boolean value negated.
    • and

      public static ToBooleanExpression and(Collection<ToBooleanExpression> operands)
      Returns a ToBooleanExpression 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

      public static ToBooleanExpression or(Collection<ToBooleanExpression> operands)
      Returns a ToBooleanExpression 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

      public static ToStringExpression concat(Collection<ToStringExpression> operands)
      Returns a ToStringExpression whose 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 a ToBooleanExpression who's boolean value is true if and only if the String values of both provided ToStringExpressions are equal.
      This method is case-sensitive. For a case-insensitive option see equalIgnoreCase(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

      public static ToBooleanExpression equalIgnoreCase(ToStringExpression a, ToStringExpression b)
      Returns a ToBooleanExpression who's boolean value is true if and only if the String values of both provided ToStringExpressions are equal.
      This method is case-insensitive. For a case-sensitive option see equal(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 a ToBooleanExpression who's boolean value is true if and only if the String values of both provided ToStringExpressions are not equal.
      This method is case-sensitive. For a case-insensitive option see notEqualIgnoreCase(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

      public static ToBooleanExpression notEqualIgnoreCase(ToStringExpression a, ToStringExpression b)
      Returns a ToBooleanExpression who's boolean value is true if and only if the String values of both provided ToStringExpressions are not equal.
      This method is case-sensitive. For a case-insensitive option see notEqual(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

      public static ToBooleanExpression startsWith(ToStringExpression a, ToStringExpression b)
      Returns a ToBooleanExpression who's boolean value is true if the String value of the first ToStringExpression starts with the String value of the second ToStringExpression.
      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.
    • startsWithIgnoreCase

      public static ToBooleanExpression startsWithIgnoreCase(ToStringExpression a, ToStringExpression b)
      Returns a ToBooleanExpression who's boolean value is true if the String value of the first ToStringExpression starts with the String value of the second ToStringExpression.
      This method ignores cases of both ToStringExpressions by lower-casing both values.
      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 a ToBooleanExpression who's boolean value is true if the String value of the first ToStringExpression ends with the String value of the second ToStringExpression.
      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.
    • endsWithIgnoreCase

      public static ToBooleanExpression endsWithIgnoreCase(ToStringExpression a, ToStringExpression b)
      Returns a ToBooleanExpression who's boolean value is true if the String value of the first ToStringExpression ends with the String value of the second ToStringExpression.
      This method ignores cases of both ToStringExpressions by lower-casing both values.
      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 a ToBooleanExpression who's boolean value is true if the String value of the first ToStringExpression contains the String value of the second ToStringExpression.
      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.
    • containsIgnoreCase

      public static ToBooleanExpression containsIgnoreCase(ToStringExpression a, ToStringExpression b)
      Returns a ToBooleanExpression who's boolean value is true if the String value of the first ToStringExpression contains the String value of the second ToStringExpression.
      This method ignores cases of both ToStringExpressions by lower-casing both values.
      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

      public static ToBooleanExpression greaterThan(ToDoubleExpression a, ToDoubleExpression b)
      Returns a 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.
      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

      public static ToBooleanExpression greaterOrEqualThan(ToDoubleExpression a, ToDoubleExpression b)
      Returns a 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.
      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 a 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.
      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

      public static ToBooleanExpression lessOrEqualThan(ToDoubleExpression a, ToDoubleExpression b)
      Returns a 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.
      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

      public static ToDoubleExpression sum(Collection<ToDoubleExpression> operands)
      Returns a ToDoubleExpression 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

      public static ToDoubleExpression product(Collection<ToDoubleExpression> operands)
      Returns a ToDoubleExpression 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 a ToDoubleExpression 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 a ToDoubleExpression 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

      public static ToDoubleExpression negateNumber(ToDoubleExpression a)
      Negates the provided ToDoubleExpression's double value.
      Parameters:
      a - The ToDoubleExpression to negate the double value of.
      Returns:
      ToDoubleExpression who's double value has been negated.