net.sourceforge.pmd.util.viewer.model

Class ViewerModel

public class ViewerModel extends Object

Constructor Summary
ViewerModel()
Method Summary
voidaddViewerModelListener(ViewerModelListener l)
voidappendToXPathExpression(String pathFragment, Object appender)
appends the given fragment to the XPath expression
voidcommitSource(String source, TargetJDKVersion jdk)
commits source code to the model. all existing source will be replaced
voidevaluateXPathExpression(String xPath, Object evaluator)
evaluates the given XPath expression against the current tree
protected voidfireViewerModelEvent(ViewerModelEvent e)
ListgetLastEvaluationResults()
retrieves the results of last evaluation
SimpleNodegetRootNode()
booleanhasCompiledTree()
determines whether the model has a compiled tree at it's disposal
voidremoveViewerModelListener(ViewerModelListener l)
voidselectNode(SimpleNode node, Object selector)
selects the given node in the AST

Constructor Detail

ViewerModel

public ViewerModel()

Method Detail

addViewerModelListener

public void addViewerModelListener(ViewerModelListener l)

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

commitSource

public void commitSource(String source, TargetJDKVersion jdk)
commits source code to the model. all existing source will be replaced

evaluateXPathExpression

public void evaluateXPathExpression(String xPath, Object evaluator)
evaluates the given XPath expression against the current tree

Parameters: xPath XPath expression to be evaluated evaluator object which requests the evaluation

fireViewerModelEvent

protected void fireViewerModelEvent(ViewerModelEvent e)

getLastEvaluationResults

public List getLastEvaluationResults()
retrieves the results of last evaluation

Returns: a list containing the nodes selected by the last XPath expression

evaluation

getRootNode

public SimpleNode getRootNode()

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

removeViewerModelListener

public void removeViewerModelListener(ViewerModelListener l)

selectNode

public void selectNode(SimpleNode node, Object selector)
selects the given node in the AST

Parameters: node node to be selected selector object which requests the selection