Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.aendvari.common.model
Class ModelQueryPath  view ModelQueryPath download ModelQueryPath.java

java.lang.Object
  extended bycom.aendvari.common.model.ModelQueryPath

public class ModelQueryPath
extends java.lang.Object

Provides the ability to access nodes within an Model Tree using an expression.

This class allows the selection of single and multiple nodes.


Nested Class Summary
protected static class ModelQueryPath.Operator
          Represents a single operation to perform during expression evaluation.
protected static class ModelQueryPath.Parser
          Parses a query expressions.
 
Field Summary
private  java.util.List operations
          Contains the compiled query expression.
 
Constructor Summary
ModelQueryPath(java.lang.String expression)
          Constructs an ModelQueryPath instance.
 
Method Summary
protected  void compile(java.lang.String expression)
          Compiles the supplied query expression.
protected  void parseIndexOperator(ModelQueryPath.Parser parser, java.lang.String segment)
          Parses an index selection operator.
 ModelNode selectNode(ModelNode context)
          Selects a single node using the compiled expression.
protected  ModelNode selectNode(ModelNode context, int operationIndex)
          Performs the query expression operations for a single node selection.
static ModelNode selectNode(ModelNode context, java.lang.String expression)
          Uses the expression to select a single node.
protected  ModelNode selectNodeByIndex(ModelQueryPath.Operator operator, ModelNode context, int operationIndex)
          Selects a child node based on its position.
protected  ModelNode selectNodeByName(ModelQueryPath.Operator operator, ModelNode context, int operationIndex)
          Selects a child node based on its name.
 java.util.Collection selectNodes(ModelNode context)
          Selects multiple nodes using the compiled expression.
protected  void selectNodes(ModelNode context, int operationIndex, java.util.Collection nodes)
          Performs the query expression operations for multiple node selection.
static java.util.Collection selectNodes(ModelNode context, java.lang.String expression)
          Uses the expression to select multiple nodes.
protected  void selectNodesByIndex(ModelQueryPath.Operator operator, ModelNode context, int operationIndex, java.util.Collection nodes)
          Selects a child node based on its position.
protected  void selectNodesByName(ModelQueryPath.Operator operator, ModelNode context, int operationIndex, java.util.Collection nodes)
          Selects child nodes based on their name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

operations

private java.util.List operations
Contains the compiled query expression.

Constructor Detail

ModelQueryPath

public ModelQueryPath(java.lang.String expression)
Constructs an ModelQueryPath instance.

Method Detail

selectNode

public ModelNode selectNode(ModelNode context)
Selects a single node using the compiled expression.


selectNodes

public java.util.Collection selectNodes(ModelNode context)
Selects multiple nodes using the compiled expression.


selectNode

public static ModelNode selectNode(ModelNode context,
                                   java.lang.String expression)
Uses the expression to select a single node.


selectNodes

public static java.util.Collection selectNodes(ModelNode context,
                                               java.lang.String expression)
Uses the expression to select multiple nodes.


selectNodeByName

protected ModelNode selectNodeByName(ModelQueryPath.Operator operator,
                                     ModelNode context,
                                     int operationIndex)
Selects a child node based on its name.


selectNodeByIndex

protected ModelNode selectNodeByIndex(ModelQueryPath.Operator operator,
                                      ModelNode context,
                                      int operationIndex)
Selects a child node based on its position.


selectNode

protected ModelNode selectNode(ModelNode context,
                               int operationIndex)
Performs the query expression operations for a single node selection.


selectNodesByName

protected void selectNodesByName(ModelQueryPath.Operator operator,
                                 ModelNode context,
                                 int operationIndex,
                                 java.util.Collection nodes)
Selects child nodes based on their name.


selectNodesByIndex

protected void selectNodesByIndex(ModelQueryPath.Operator operator,
                                  ModelNode context,
                                  int operationIndex,
                                  java.util.Collection nodes)
Selects a child node based on its position.


selectNodes

protected void selectNodes(ModelNode context,
                           int operationIndex,
                           java.util.Collection nodes)
Performs the query expression operations for multiple node selection.


parseIndexOperator

protected void parseIndexOperator(ModelQueryPath.Parser parser,
                                  java.lang.String segment)
Parses an index selection operator.


compile

protected void compile(java.lang.String expression)
Compiles the supplied query expression.