net.sourceforge.pmd.util.viewer.model

## Class ViewerModel

- java.lang.Object
- - net.sourceforge.pmd.util.viewer.model.ViewerModel

-     public class ViewerModel
      extends Object

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ViewerModel()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addViewerModelListener(ViewerModelListener l)`
    `void` | `appendToXPathExpression(String pathFragment, Object appender)` appends the given fragment to the XPath expression
    `void` | `commitSource(String source, LanguageVersion languageVersion)` commits source code to the model.
    `void` | `evaluateXPathExpression(String xPath, Object evaluator)` evaluates the given XPath expression against the current tree
    `protected void` | `fireViewerModelEvent(ViewerModelEvent e)`
    `List<Node>` | `getLastEvaluationResults()` retrieves the results of last evaluation
    `Node` | `getRootNode()`
    `boolean` | `hasCompiledTree()` determines whether the model has a compiled tree at it's disposal
    `void` | `removeViewerModelListener(ViewerModelListener l)`
    `void` | `selectNode(Node node, Object selector)` selects the given node in the AST

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

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

- - ### Constructor Detail

    - #### ViewerModel

          public ViewerModel()

  - ### Method Detail

    - #### getRootNode

          public Node getRootNode()

    - #### commitSource

          public void commitSource(String source,
                          LanguageVersion languageVersion)

      commits source code to the model. all existing source will be replaced

    - #### hasCompiledTree

          public boolean hasCompiledTree()

      determines whether the model has a compiled tree at it's disposal
      Returns:
        true if there is an AST, false otherwise

    - #### evaluateXPathExpression

          public void evaluateXPathExpression(String xPath,
                                     Object evaluator)
                                       throws ParseException,
                                              org.jaxen.JaxenException

      evaluates the given XPath expression against the current tree
      Parameters:
        `xPath` - XPath expression to be evaluated
        `evaluator` - object which requests the evaluation
      Throws:
        `ParseException`
        `org.jaxen.JaxenException`

    - #### getLastEvaluationResults

          public List<Node> getLastEvaluationResults()

      retrieves the results of last evaluation
      Returns:
        a list containing the nodes selected by the last XPath expression

        evaluation

    - #### selectNode

          public void selectNode(Node node,
                        Object selector)

      selects the given node in the AST
      Parameters:
        `node` - node to be selected
        `selector` - object which requests the selection

    - #### appendToXPathExpression

          public void appendToXPathExpression(String pathFragment,
                                     Object appender)

      appends the given fragment to the XPath expression
      Parameters:
        `pathFragment` - fragment to be added
        `appender` - object that is trying to append the fragment

    - #### addViewerModelListener

          public void addViewerModelListener(ViewerModelListener l)

    - #### removeViewerModelListener

          public void removeViewerModelListener(ViewerModelListener l)

    - #### fireViewerModelEvent

          protected void fireViewerModelEvent(ViewerModelEvent e)

Copyright © 2002-2013 InfoEther. All Rights Reserved.