Package org.eclipse.m2m.atl.common

# Class AtlNbCharFile

java.lang.Object
org.eclipse.m2m.atl.common.AtlNbCharFile

public class AtlNbCharFile extends Object
This class is used by a stackframe to compute char position in a file With the file name and project name, this structure build a list for each line the position of its first char and the position of the tabs.

## Constructor Summary

Constructors
Constructor
Description
`AtlNbCharFile(InputStream in)`
The AtlNbCharFile constructor.

## Method Summary

Modifier and Type
Method
Description
`int`
`getIndex(String cursorPosition)`
Returns computes the char start position from the string "cursorLine:cursorColumn" given by Eclipse (tabs are 4 chars long by default, but it is user-configurable).
`int[]`
`getIndexChar(String sourceLocation)`
Returns the index char in the source location.
`int[]`
`getIndexChar(String sourceLocation, int tabWidth)`
Returns an array of int: first element is startChar, second element is endChar.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### AtlNbCharFile

public AtlNbCharFile(InputStream in)
The AtlNbCharFile constructor.

Parameters:
  `in` - the input stream

## Method Details

### getIndexChar

public int[] getIndexChar(String sourceLocation)
Returns the index char in the source location.

Parameters:
  `sourceLocation` - the source
Returns:
  the index char in the source location

### getIndexChar

public int[] getIndexChar(String sourceLocation, int tabWidth)
Returns an array of int: first element is startChar, second element is endChar. *

Parameters:
  `sourceLocation` - the string representing "startLine:startColumn-endLine:endColumn" the location given by antlr (tabs are 8 chars long)
  `tabWidth` - the width of the tab
Returns:
  An array of int: first element is startChar, second element is endChar

### getIndex

public int getIndex(String cursorPosition)
Returns computes the char start position from the string "cursorLine:cursorColumn" given by Eclipse (tabs are 4 chars long by default, but it is user-configurable).

Parameters:
  `cursorPosition` - the string representing the cursor position
Returns:
  computes the char start position from the string "cursorLine:cursorColumn" given by Eclipse (tabs are 4 chars long by default, but it is user-configurable)
Throws:
  `NumberFormatException`
  `IndexOutOfBoundsException`