Class UnaryExpression

java.lang.Object
com.strobel.expressions.Expression
com.strobel.expressions.UnaryExpression

public final class UnaryExpression extends Expression
Represents an expression that has a unary operator.
  • Field Details

  • Constructor Details

  • Method Details

    • getOperand

      public final Expression getOperand()
      Gets the implementing method for the unary operation.
      Returns:
      an Expression that represents the operand of the unary operation.
    • getMethod

      public final MethodInfo getMethod()
      Gets the implementing method for the unary operation.
      Returns:
      the MethodInfo that represents the implementing method.
    • getType

      public final Type<?> getType()
      Description copied from class: Expression
      Gets the static type of the expression that this Expression represents.
      Overrides:
      getType in class Expression
      Returns:
      the Type that represents the static type of the expression.
    • getNodeType

      public final ExpressionType getNodeType()
      Description copied from class: Expression
      Returns the node type of this Expression.
      Overrides:
      getNodeType in class Expression
      Returns:
      the ExpressionType that represents this expression.
    • accept

      protected final Expression accept(ExpressionVisitor visitor)
      Description copied from class: Expression
      Dispatches to the specific visit method for this node type. For example, BinaryExpression will call into ExpressionVisitor.visitBinary().
      Overrides:
      accept in class Expression
      Parameters:
      visitor - the visitor to visit this node.
      Returns:
      the result of visiting this node.
    • canReduce

      public final boolean canReduce()
      Description copied from class: Expression
      Indicates that the node can be reduced to a simpler node. If this returns true, reduce() can be called to produce the reduced form.
      Overrides:
      canReduce in class Expression
      Returns:
      true if the node can be reduced; otherwise, false.
    • reduce

      public final Expression reduce()
      Description copied from class: Expression
      Reduces this node to a simpler expression. If canReduce() returns true, this should return a valid expression. This method is allowed to return another node which itself must be reduced.
      Overrides:
      reduce in class Expression
      Returns:
      the reduced expression.
    • reduceVariable

      private Expression reduceVariable()
    • reduceMember

      private Expression reduceMember()
    • isPrefix

      private boolean isPrefix()
    • functionalOp

      private UnaryExpression functionalOp(Expression operand)
    • update

      public final UnaryExpression update(Expression operand)