Package de.gebit.integrity.modelsource

## Class DefaultModelSourceExplorer

- java.lang.Object
- - de.gebit.integrity.modelsource.DefaultModelSourceExplorer

- All Implemented Interfaces:
    `ModelSourceExplorer`

      public class DefaultModelSourceExplorer
      extends Object
      implements ModelSourceExplorer

  Default implementation of a `ModelSourceExplorer`.
  Author:
    Rene Schneider - initial API and implementation

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `DefaultModelSourceExplorer()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `String` | `determineSourceFilePath​(org.eclipse.emf.ecore.EObject aModelElement)` | Determines the full path to the source file in which a certain element is defined.
    `protected String` | `determineSourceFilePath​(org.eclipse.xtext.nodemodel.ICompositeNode aNode)` | Finds the source file path for a given `ICompositeNode` and cleans it up, removing Xtext-specific stuff and resulting in a clean absolute path.
    `ModelSourceInformationElement` | `determineSourceInformation​(org.eclipse.emf.ecore.EObject aModelElement)` | Determines all information about the source of a model element at once.
    `int` | `determineSourceLine​(org.eclipse.emf.ecore.EObject aModelElement)` | Finds the line in the original script file at which a certain element starts.
    `protected int` | `determineSourceLine​(org.eclipse.xtext.nodemodel.ICompositeNode aNode)` | Finds the line number in the source file matching a given `ICompositeNode`.
    `String` | `determineSourceSnippet​(org.eclipse.emf.ecore.EObject aModelElement)` | Finds the textual snippet from which a model element was originally parsed.
    `protected String` | `determineSourceSnippet​(org.eclipse.xtext.nodemodel.ICompositeNode aNode)` | Finds the source snippet matching a given `ICompositeNode`.
    `protected org.eclipse.xtext.nodemodel.ICompositeNode` | `findNode​(org.eclipse.emf.ecore.EObject aModelElement)` | Finds the node conforming to a given model element.

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

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

- - ### Constructor Detail

    - #### DefaultModelSourceExplorer

          public DefaultModelSourceExplorer()

  - ### Method Detail

    - #### determineSourceFilePath

          public String determineSourceFilePath​(org.eclipse.emf.ecore.EObject aModelElement)

      Description copied from interface: `ModelSourceExplorer`
      Determines the full path to the source file in which a certain element is defined.
      Specified by:
        `determineSourceFilePath` in interface `ModelSourceExplorer`
      Parameters:
        `aModelElement` - the element
      Returns:
        the file path

    - #### determineSourceFilePath

          protected String determineSourceFilePath​(org.eclipse.xtext.nodemodel.ICompositeNode aNode)

      Finds the source file path for a given `ICompositeNode` and cleans it up, removing Xtext-specific stuff and resulting in a clean absolute path.
      Parameters:
        `aNode` - the node to investigate
      Returns:
        the path

    - #### determineSourceSnippet

          public String determineSourceSnippet​(org.eclipse.emf.ecore.EObject aModelElement)

      Description copied from interface: `ModelSourceExplorer`
      Finds the textual snippet from which a model element was originally parsed.
      Specified by:
        `determineSourceSnippet` in interface `ModelSourceExplorer`
      Parameters:
        `aModelElement` - the element
      Returns:
        the snippet

    - #### determineSourceSnippet

          protected String determineSourceSnippet​(org.eclipse.xtext.nodemodel.ICompositeNode aNode)

      Finds the source snippet matching a given `ICompositeNode`.
      Parameters:
        `aNode` - the node to investigate
      Returns:
        the source snippet (trimmed)

    - #### determineSourceLine

          public int determineSourceLine​(org.eclipse.emf.ecore.EObject aModelElement)

      Description copied from interface: `ModelSourceExplorer`
      Finds the line in the original script file at which a certain element starts.
      Specified by:
        `determineSourceLine` in interface `ModelSourceExplorer`
      Parameters:
        `aModelElement` - the element
      Returns:
        the line number

    - #### determineSourceLine

          protected int determineSourceLine​(org.eclipse.xtext.nodemodel.ICompositeNode aNode)

      Finds the line number in the source file matching a given `ICompositeNode`.
      Parameters:
        `aNode` - the node to investigate
      Returns:
        the line number

    - #### determineSourceInformation

          public ModelSourceInformationElement determineSourceInformation​(org.eclipse.emf.ecore.EObject aModelElement)

      Description copied from interface: `ModelSourceExplorer`
      Determines all information about the source of a model element at once.
      Specified by:
        `determineSourceInformation` in interface `ModelSourceExplorer`
      Parameters:
        `aModelElement` - the element
      Returns:
        the information container

    - #### findNode

          protected org.eclipse.xtext.nodemodel.ICompositeNode findNode​(org.eclipse.emf.ecore.EObject aModelElement)

      Finds the node conforming to a given model element. This will never return null, but throw an `IllegalArgumentException` instead, if no node could be found.
      Parameters:
        `aModelElement` - the model element to investigate
      Returns:
        the node