Class BinaryExpression

java.lang.Object
team.unnamed.mocha.parser.ast.BinaryExpression
All Implemented Interfaces:
Expression

public final class BinaryExpression extends Object implements Expression
Expression implementation for binary expressions (expressions composed by two other expressions)

Example binary expressions: 1 + 1, 5 * 9, a == b, a < b, true ?? false

Since:
3.0.0
  • Constructor Details

  • Method Details

    • op

      @NotNull public @NotNull BinaryExpression.Op op()
      Gets the binary expression type/operation.
      Returns:
      The expression operation.
      Since:
      3.0.0
    • left

      @NotNull public @NotNull Expression left()
      Gets the left-hand expression for this binary expression.
      Returns:
      The left-hand expression
      Since:
      3.0.0
    • left

      public void left(@NotNull @NotNull Expression left)
      Sets the left-hand expression for this binary expression.
      Parameters:
      left - The left-hand expression
      Since:
      3.0.0
    • right

      @NotNull public @NotNull Expression right()
      Gets the right-hand expression for this binary expression.
      Returns:
      The right-hand expression
      Since:
      3.0.0
    • right

      public void right(@NotNull @NotNull Expression right)
      Sets the right-hand expression for this binary expression.
      Parameters:
      right - The right-hand expression
      Since:
      3.0.0
    • visit

      public <R> R visit(@NotNull @NotNull ExpressionVisitor<R> visitor)
      Description copied from interface: Expression
      Visits this expression with the given visitor.
      Specified by:
      visit in interface Expression
      Type Parameters:
      R - The visit result return type
      Parameters:
      visitor - The expression visitor
      Returns:
      The visit result
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object