public interface

IJavaAssignment

implements IJavaStatement
com.pnfsoftware.jeb.core.units.code.java.IJavaAssignment

Class Overview

Java AST interface to represent assignments.

Example of a simple assignment:

 left = right
 

A simple assignment can be modified to represent non-standard assignments:

  • A combined-operator assignment
  • A unary-operator assignment

Summary

[Expand]
Inherited Constants
From interface com.pnfsoftware.jeb.core.units.code.java.IJavaElement
Public Methods
abstract IJavaAssignment duplicate()
Duplicate this element.
abstract IJavaOperator getCombinedOperator()
Retrieve the combined operator of a combined assignment.
abstract IJavaLeftExpression getLeft()
Get the left part of the assignment.
abstract IJavaExpression getRight()
Get the right part of the assignment.
abstract void getUnaryOperator(boolean[] r)
Retrieve the unary operator of a unary operator assignment.
abstract boolean isCombinedOperatorAssignment()
Determine if the assignment is a combined assignment.
abstract boolean isSimpleAssignment()
Determine if the assignment is a regular ('=') assignment.
abstract boolean isUnaryOperatorAssignment()
Determine if the assignment is a unary-operator assignment.
abstract void setCombinedOperator(IJavaOperator operator)
Transform a simple assignment into a combined operator assignment.
abstract void setCombinedOperatorAssignment(IJavaOperator operator, IJavaExpression right)
Transform a simple assignment into a combined operator assignment.
abstract void setLeft(IJavaLeftExpression left)
Set the left part of the assignment.
abstract void setRight(IJavaExpression right)
Set the right part of the assignment.
abstract void setUnaryOperator(boolean isIncrement, boolean isPrefixed)
Transform the non-unary assignment into one of the four unary assignments: postfix increment, postfix decrement, prefix increment, prefix decrement.
[Expand]
Inherited Methods
From interface com.pnfsoftware.jeb.core.units.code.java.IJavaElement
From interface com.pnfsoftware.jeb.core.units.code.java.IJavaExpression
From interface com.pnfsoftware.jeb.core.units.code.java.IJavaStatement

Public Methods

public abstract IJavaAssignment duplicate ()

Duplicate this element.

Returns
  • a (possibly) duplicated object of the same type

public abstract IJavaOperator getCombinedOperator ()

Retrieve the combined operator of a combined assignment.

Example: for "a += b", the operator returned would be "+"

Returns
  • the basic operator that is used to make the assignment a combined assignment
Throws
IllegalStateException if the assignment is not a combined assignment

public abstract IJavaLeftExpression getLeft ()

Get the left part of the assignment.

public abstract IJavaExpression getRight ()

Get the right part of the assignment.

public abstract void getUnaryOperator (boolean[] r)

Retrieve the unary operator of a unary operator assignment.

Parameters
r mandatory 2-element array, will be set to {is_increment, is_prefixed}
Throws
IllegalStateException if the assignment is not a unary assignment

public abstract boolean isCombinedOperatorAssignment ()

Determine if the assignment is a combined assignment. There are 11 possible types of combined operators. Examples include: '+=', '-=', etc.

public abstract boolean isSimpleAssignment ()

Determine if the assignment is a regular ('=') assignment.

public abstract boolean isUnaryOperatorAssignment ()

Determine if the assignment is a unary-operator assignment.

Example: i++ or --j

Returns
  • true if the assignment is a unary-operator assignment

public abstract void setCombinedOperator (IJavaOperator operator)

Transform a simple assignment into a combined operator assignment. The current assignment cannot be a unary assignment, else the method will throw.

Parameters
operator mandatory combined operator, there are eleven possibilities:
MUL, DIV, ADD, SUB, REM, SHL, SHR, USHR, AND, XOR, OR

public abstract void setCombinedOperatorAssignment (IJavaOperator operator, IJavaExpression right)

Transform a simple assignment into a combined operator assignment. The current assignment cannot be a unary assignment, else the method will throw.

Parameters
operator mandatory combined operator, there are eleven possibilities:
MUL, DIV, ADD, SUB, REM, SHL, SHR, USHR, AND, XOR, OR
right optional, updated right member of the assignment

public abstract void setLeft (IJavaLeftExpression left)

Set the left part of the assignment.

Parameters
left mandatory left expression

public abstract void setRight (IJavaExpression right)

Set the right part of the assignment. The assignment cannot be a unary assignment.

Parameters
right mandatory right expression

public abstract void setUnaryOperator (boolean isIncrement, boolean isPrefixed)

Transform the non-unary assignment into one of the four unary assignments: postfix increment, postfix decrement, prefix increment, prefix decrement. The right member of the expression is automatically nullified.

Parameters
isIncrement true for increment, false for decrement
isPrefixed true for prefixed, false for postfixed