All Superinterfaces:
ICElement, ICExpression, ICLeftExpression

@Ser public interface ICOperation extends ICLeftExpression
C AST interface to represent arithmetic and logical expressions.

An expression consists of one or two members (the left and right members) and an operator. The left member is optional, and should be null for unary operators.

A third member may be specified for ternary expressions.

Examples:

 a + 1
 a * ((int)b - foo())
 !x
 x ^ y | z
 c ? a: b
 
  • Method Details

    • getOperator

      ICOperator getOperator()
    • setOperator

      void setOperator(ICOperator operator)
      Set the operator for the expression. Dangerous method! the operator type is not checked, it is the caller's responsibility to do so.
      Parameters:
      operator - operator, cannot be null
    • getOperatorType

      default COperatorType getOperatorType()
    • checkOperatorType

      default boolean checkOperatorType(COperatorType optype)
    • getCountOfOperands

      int getCountOfOperands()
    • getFirstOperand

      ICExpression getFirstOperand()
      Get the first operand, never null.
    • setFirstOperand

      void setFirstOperand(ICExpression e)
      Parameters:
      e -
    • getSecondOperand

      ICExpression getSecondOperand()
      Get the second operand, might be null.
    • setSecondOperand

      void setSecondOperand(ICExpression e)
      Parameters:
      e -
    • getThirdOperand

      ICExpression getThirdOperand()
      Get the third operand, might be null.
    • setThirdOperand

      void setThirdOperand(ICExpression e)
      Parameters:
      e -
    • reverse

      boolean reverse(ICOperatorFactory of)
      Logical negation of the operation, whenever possible. The object is modified.
      Parameters:
      of -
      Returns:
      true if reversing was possible, false otherwise
    • mirror

      boolean mirror(ICOperatorFactory of)
      Mirror the operation order, whenever possible. The object is modified.
      Parameters:
      of -
      Returns:
      true if mirroring was possible, false otherwise
    • duplicate

      ICOperation duplicate()
      Description copied from interface: ICElement
      Deep duplication of the element. Sub-elements are duplicated.

      Note: ICClass, ICMethod, ICField, ICIdentifier, ICConstant, ICType and ICLabel are not duplicated.

      Specified by:
      duplicate in interface ICElement
      Specified by:
      duplicate in interface ICExpression
      Specified by:
      duplicate in interface ICLeftExpression