Example usage for org.eclipse.jdt.core.dom NumberLiteral getStartPosition

List of usage examples for org.eclipse.jdt.core.dom NumberLiteral getStartPosition

Introduction

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

Prototype

public final int getStartPosition() 

Source Link

Document

Returns the character index into the original source file indicating where the source fragment corresponding to this node begins.

Usage

From source file:nl.han.ica.core.ast.visitors.NumberLiteralVisitor.java

/**
 * Get the number literal that violated the rules
 *
 * @param beginLine   beginline of the ruleviolation
 * @param beginColumn begincolumn of the ruleviolation
 * @return numberliteral that starts on same beginline and begincolumn
 *///from   ww  w . j a v a2  s. co m
public NumberLiteral getLiteralViolation(int beginLine, int beginColumn) {
    NumberLiteral literalViolation = null;

    for (NumberLiteral numberLiteral : numberLiterals) {
        if (compilationUnit.getColumnNumber(numberLiteral.getStartPosition()) == beginColumn - 1
                && compilationUnit.getLineNumber(numberLiteral.getStartPosition()) == beginLine) {
            literalViolation = numberLiteral;
        }
    }
    return literalViolation;
}