Example usage for org.eclipse.jdt.core.dom PostfixExpression setSourceRange

List of usage examples for org.eclipse.jdt.core.dom PostfixExpression setSourceRange

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.dom PostfixExpression setSourceRange.

Prototype

public final void setSourceRange(int startPosition, int length) 

Source Link

Document

Sets the source range of the original source file where the source fragment corresponding to this node was found.

Usage

From source file:org.eclipse.jdt.core.dom.ASTConverter.java

License:Open Source License

public PostfixExpression convert(org.eclipse.jdt.internal.compiler.ast.PostfixExpression expression) {
    final PostfixExpression postfixExpression = new PostfixExpression(this.ast);
    if (this.resolveBindings) {
        recordNodes(postfixExpression, expression);
    }/*from   w w w.j  av  a 2s  .  co  m*/
    postfixExpression.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1);
    postfixExpression.setOperand(convert(expression.lhs));
    switch (expression.operator) {
    case org.eclipse.jdt.internal.compiler.ast.OperatorIds.PLUS:
        postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT);
        break;
    case org.eclipse.jdt.internal.compiler.ast.OperatorIds.MINUS:
        postfixExpression.setOperator(PostfixExpression.Operator.DECREMENT);
        break;
    }
    return postfixExpression;
}