org.apache.xpath.compiler
Class OpMap

java.lang.Object
  |
  +--org.apache.xpath.compiler.OpMap
Direct Known Subclasses:
Compiler

public class OpMap
extends java.lang.Object

This class represents the data structure basics of the XPath object.


Field Summary
 int[] m_opMap
          An operations map is used instead of a proper parse tree.
 java.lang.Object[] m_tokenQueue
          TokenStack is the queue of used tokens.
 int m_tokenQueueSize
          The current size of the token queue.
static int MAPINDEX_LENGTH
          **For advanced use only** The length is always the opcode position + 1.
 
Constructor Summary
OpMap()
           
 
Method Summary
 int getArgLength(int opPos)
          **For advanced use only** Go to the first child of a given operation.
 int getArgLengthOfStep(int opPos)
          **For advanced use only** Go to the first child of a given operation.
static int getFirstChildPos(int opPos)
          **For advanced use only** Go to the first child of a given operation.
static int getFirstChildPosOfStep(int opPos)
          **For advanced use only** Go to the first child of a given operation.
 int getFirstPredicateOpPos(int opPos)
          **For advanced use only** Given an FROM_stepType position, return the position of the first predicate, if there is one, or else this will point to the end of the FROM_stepType.
 int getNextOpPos(int opPos)
          **For advanced use only** Given an operation position, return the end position, i.e.
static int getNextOpPos(int[] opMap, int opPos)
          **For advanced use only** Given an operation position, return the end position, i.e.
 int getNextStepPos(int opPos)
          **For advanced use only** Given an operation position, return the end position, i.e.
 int getOp(int opPos)
          **For advanced use only** Given an operation position, return the current op.
 int[] getOpMap()
          **For advanced use only** Get the opcode list that describes the XPath operations.
 java.lang.String getPatternString()
          Get the pattern string.
 java.lang.String getStepLocalName(int opPosOfStep)
          **For advanced use only** Get the local name of the step.
 java.lang.String getStepNS(int opPosOfStep)
          **For advanced use only** Get the namespace of the step.
 int getStepTestType(int opPosOfStep)
          **For advanced use only** Get the test type of the step, i.e.
 java.util.Vector getTargetElementQNames()
          **For advanced use only** This method is for building indexes of match patterns for fast lookup.
 java.lang.Object getToken(int pos)
          **For advanced use only** Get the XPath as a list of tokens.
 java.lang.Object[] getTokenQueue()
          **For advanced use only** Get the XPath as a list of tokens.
 int getTokenQueueSize()
          **For advanced use only** Get size of the token queue.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_tokenQueue

public java.lang.Object[] m_tokenQueue
TokenStack is the queue of used tokens. The current token is the token at the end of the m_tokenQueue. The idea is that the queue can be marked and a sequence of tokens can be reused.

m_tokenQueueSize

public int m_tokenQueueSize
The current size of the token queue.

m_opMap

public int[] m_opMap
An operations map is used instead of a proper parse tree. It contains operations codes and indexes into the m_tokenQueue. I use an array instead of a full parse tree in order to cut down on the number of objects created.

MAPINDEX_LENGTH

public static final int MAPINDEX_LENGTH
**For advanced use only** The length is always the opcode position + 1. Length is always expressed as the opcode+length bytes, so it is always 2 or greater.
Constructor Detail

OpMap

public OpMap()
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getPatternString

public java.lang.String getPatternString()
Get the pattern string.

getTokenQueue

public java.lang.Object[] getTokenQueue()
**For advanced use only** Get the XPath as a list of tokens.

getToken

public java.lang.Object getToken(int pos)
**For advanced use only** Get the XPath as a list of tokens.

getTokenQueueSize

public int getTokenQueueSize()
**For advanced use only** Get size of the token queue.

getOpMap

public int[] getOpMap()
**For advanced use only** Get the opcode list that describes the XPath operations. It contains operations codes and indexes into the m_tokenQueue. I use an array instead of a full parse tree in order to cut down on the number of objects created.

getOp

public int getOp(int opPos)
**For advanced use only** Given an operation position, return the current op.
Returns:
position of next operation in m_opMap.

getNextOpPos

public int getNextOpPos(int opPos)
**For advanced use only** Given an operation position, return the end position, i.e. the beginning of the next operation.
Returns:
position of next operation in m_opMap.

getNextStepPos

public int getNextStepPos(int opPos)
**For advanced use only** Given an operation position, return the end position, i.e. the beginning of the next operation.
Returns:
position of next operation in m_opMap.

getNextOpPos

public static int getNextOpPos(int[] opMap,
                               int opPos)
**For advanced use only** Given an operation position, return the end position, i.e. the beginning of the next operation.
Returns:
position of next operation in m_opMap.

getFirstPredicateOpPos

public int getFirstPredicateOpPos(int opPos)
**For advanced use only** Given an FROM_stepType position, return the position of the first predicate, if there is one, or else this will point to the end of the FROM_stepType. Example: int posOfPredicate = xpath.getNextOpPos(stepPos); boolean hasPredicates = OpCodes.OP_PREDICATE == xpath.getOp(posOfPredicate);
Returns:
position of predicate in FROM_stepType structure.

getFirstChildPos

public static int getFirstChildPos(int opPos)
**For advanced use only** Go to the first child of a given operation.

getArgLength

public int getArgLength(int opPos)
**For advanced use only** Go to the first child of a given operation.

getArgLengthOfStep

public int getArgLengthOfStep(int opPos)
**For advanced use only** Go to the first child of a given operation.

getFirstChildPosOfStep

public static int getFirstChildPosOfStep(int opPos)
**For advanced use only** Go to the first child of a given operation.

getStepTestType

public int getStepTestType(int opPosOfStep)
**For advanced use only** Get the test type of the step, i.e. NODETYPE_XXX value.
Parameters:
opPosOfStep - The position of the FROM_XXX step.

getStepNS

public java.lang.String getStepNS(int opPosOfStep)
**For advanced use only** Get the namespace of the step.
Parameters:
opPosOfStep - The position of the FROM_XXX step.

getStepLocalName

public java.lang.String getStepLocalName(int opPosOfStep)
**For advanced use only** Get the local name of the step.
Parameters:
opPosOfStep - The position of the FROM_XXX step.

getTargetElementQNames

public java.util.Vector getTargetElementQNames()
**For advanced use only** This method is for building indexes of match patterns for fast lookup. This allows a caller to get the QName, and quickly find the likely candidates that may match. Note that this will produce QName objects that aren't strictly legal, like "*".


Copyright © 2000 Apache XML Project. All Rights Reserved.