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

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

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.dom InstanceofExpression 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 InstanceofExpression convert(org.eclipse.jdt.internal.compiler.ast.InstanceOfExpression expression) {
    InstanceofExpression instanceOfExpression = new InstanceofExpression(this.ast);
    if (this.resolveBindings) {
        recordNodes(instanceOfExpression, expression);
    }/* ww  w .ja v  a 2 s. co m*/
    Expression leftExpression = convert(expression.expression);
    instanceOfExpression.setLeftOperand(leftExpression);
    final Type convertType = convertType(expression.type);
    instanceOfExpression.setRightOperand(convertType);
    int startPosition = leftExpression.getStartPosition();
    int sourceEnd = convertType.getStartPosition() + convertType.getLength() - 1;
    instanceOfExpression.setSourceRange(startPosition, sourceEnd - startPosition + 1);
    return instanceOfExpression;
}