org.eclipse.m2m.atl.common
Class AtlNbCharFile

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

public class AtlNbCharFile
extends java.lang.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
AtlNbCharFile(java.io.InputStream in)
          The AtlNbCharFile constructor.
 
Method Summary
 int getIndex(java.lang.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(java.lang.String sourceLocation)
          Returns the index char in the source location.
 int[] getIndexChar(java.lang.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 Detail

AtlNbCharFile

public AtlNbCharFile(java.io.InputStream in)
The AtlNbCharFile constructor.

Parameters:
in - the input stream
Method Detail

getIndexChar

public int[] getIndexChar(java.lang.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(java.lang.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(java.lang.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)

Copyright 2007 IBM Corporation and others.
All Rights Reserved.