Package org.eclipse.m2m.atl.adt.ui.text.atl

# Class AtlModelAnalyser

java.lang.Object
org.eclipse.m2m.atl.adt.ui.text.atl.AtlModelAnalyser

public class AtlModelAnalyser extends Object
Atl model analyser, used to get information from an incomplete ATL model.

## Constructor Summary

Constructors
Constructor
Description
`AtlModelAnalyser(AtlCompletionHelper helper, org.eclipse.emf.ecore.EObject emfRoot, int modelOffset, String fileContext)`
Creates an analyser for ATL models.

## Method Summary

Modifier and Type
Method
Description
`void`
`displayModel()`
Debugging utility (for a developer purpose).
`org.eclipse.emf.ecore.EObject`
`getContainer(org.eclipse.emf.ecore.EObject element)`
Search the parent element of the given element, if present.
`List<org.eclipse.emf.ecore.EObject>`
`getContainers(org.eclipse.emf.ecore.EObject element)`
Computes an ordered list of containers of the given element.
`String`
`getContext(int offset)`
Compute the context of the given offset.
`AtlCompletionHelper`
`getHelper()`
`org.eclipse.emf.ecore.EObject`
`getLastLostElementByType(String typeName)`
Returns the last lost types having the given type.
`org.eclipse.emf.ecore.EObject`
`getLocatedElement(int offset)`
Returns the element available at the given offset
`List<org.eclipse.emf.ecore.EObject>`
`getLostElementsByType(String typeName)`
Returns the list of the lost types having the given type.
`List<String>`
`getLostTypesNames()`
Returns the list of the lost types names.
`int`
`getModelOffset()`
`org.eclipse.emf.ecore.EObject`
`getPreviousElement(org.eclipse.emf.ecore.EObject element)`
Computes the previous element in the model.
`org.eclipse.emf.ecore.EObject`
`getPreviousElement(org.eclipse.emf.ecore.EObject element, String type)`
Computes the previous element in the model.
`org.eclipse.emf.ecore.EObject`
`getPreviouslyParsedElement(org.eclipse.emf.ecore.EObject element)`
Computes the previous element in the model.
`org.eclipse.emf.ecore.EObject`
`getRoot()`
`String`
`getText(org.eclipse.emf.ecore.EObject locatedElement)`
Returns the text associated to the given located element.

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

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

## Constructor Details

### AtlModelAnalyser

public AtlModelAnalyser(AtlCompletionHelper helper, org.eclipse.emf.ecore.EObject emfRoot, int modelOffset, String fileContext)
Creates an analyser for ATL models.

Parameters:
  `helper` - the completion helper
  `emfRoot` - the model root
  `modelOffset` - the model offset
  `fileContext` - the main context of the file

## Method Details

### getContext

public String getContext(int offset) throws org.eclipse.jface.text.BadLocationException
Compute the context of the given offset.

Parameters:
  `offset` - the current offset
Returns:
  the context
Throws:
  `org.eclipse.jface.text.BadLocationException`

### getContainers

public List<org.eclipse.emf.ecore.EObject> getContainers(org.eclipse.emf.ecore.EObject element) throws org.eclipse.jface.text.BadLocationException
Computes an ordered list of containers of the given element.

Parameters:
  `element` - the element
Returns:
  the list of containers
Throws:
  `org.eclipse.jface.text.BadLocationException`

### getContainer

public org.eclipse.emf.ecore.EObject getContainer(org.eclipse.emf.ecore.EObject element) throws org.eclipse.jface.text.BadLocationException
Search the parent element of the given element, if present.

Parameters:
  `element` - the element
Returns:
  the parent element
Throws:
  `org.eclipse.jface.text.BadLocationException`

### getPreviouslyParsedElement

public org.eclipse.emf.ecore.EObject getPreviouslyParsedElement(org.eclipse.emf.ecore.EObject element) throws org.eclipse.jface.text.BadLocationException
Computes the previous element in the model.

Parameters:
  `element` - the current element
Returns:
  the previous element
Throws:
  `org.eclipse.jface.text.BadLocationException`

### getPreviousElement

public org.eclipse.emf.ecore.EObject getPreviousElement(org.eclipse.emf.ecore.EObject element) throws org.eclipse.jface.text.BadLocationException
Computes the previous element in the model.

Parameters:
  `element` - the current element
Returns:
  the previous element
Throws:
  `org.eclipse.jface.text.BadLocationException`

### getPreviousElement

public org.eclipse.emf.ecore.EObject getPreviousElement(org.eclipse.emf.ecore.EObject element, String type) throws org.eclipse.jface.text.BadLocationException
Computes the previous element in the model.

Parameters:
  `element` - the current element
  `type` - the previous element type
Returns:
  the previous element
Throws:
  `org.eclipse.jface.text.BadLocationException`

### getLocatedElement

public org.eclipse.emf.ecore.EObject getLocatedElement(int offset) throws org.eclipse.jface.text.BadLocationException
Returns the element available at the given offset

Parameters:
  `offset` - the current offset
Returns:
  the model element
Throws:
  `org.eclipse.jface.text.BadLocationException`

### getLostTypesNames

public List<String> getLostTypesNames()
Returns the list of the lost types names. A type is "lost" when it has no container and no location.

Returns:
  the list of the lost types names

### getLostElementsByType

public List<org.eclipse.emf.ecore.EObject> getLostElementsByType(String typeName)
Returns the list of the lost types having the given type.

Parameters:
  `typeName` - the type name
Returns:
  the list of the lost types

### getLastLostElementByType

public org.eclipse.emf.ecore.EObject getLastLostElementByType(String typeName)
Returns the last lost types having the given type.

Parameters:
  `typeName` - the type name
Returns:
  the lost types

### displayModel

public void displayModel()
Debugging utility (for a developer purpose).

### getText

public String getText(org.eclipse.emf.ecore.EObject locatedElement) throws org.eclipse.jface.text.BadLocationException
Returns the text associated to the given located element.

Parameters:
  `locatedElement` - the element
Returns:
  the text associated to the given located element
Throws:
  `org.eclipse.jface.text.BadLocationException`

### getModelOffset

public int getModelOffset()

### getRoot

public org.eclipse.emf.ecore.EObject getRoot()

### getHelper

public AtlCompletionHelper getHelper()