BEA Systems, Inc.

WebLogic Server 6.1 API Reference

weblogic.apache.xpath.compiler
Class OpMap

java.lang.Object
  |
  +--weblogic.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.

This class is based on an implementation from the Apache XML Project. In future releases the XML parser, XSLT processor, and associated classes will likely be updated to be based on a later version of the Apache implementations. Since Apache does not guarantee backwards compatibility between versions of their software, we cannot guarantee backwards compatibility of any of the classes contained in the weblogic.apache package or sub-packages.


Field Summary
protected  java.lang.String m_currentPattern
          The current pattern string, for diagnostics purposes
 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
          The length is always the opcode position + 1.
 
Constructor Summary
OpMap()
           
 
Method Summary
 int getArgLength(int opPos)
          Get the length of an operation.
 int getArgLengthOfStep(int opPos)
          Given a location step, get the length of that step.
static int getFirstChildPos(int opPos)
          Go to the first child of a given operation.
static int getFirstChildPosOfStep(int opPos)
          Get the first child position of a given location step.
 int getFirstPredicateOpPos(int opPos)
          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)
          Given an operation position, return the end position, i.e.
static int getNextOpPos(int[] opMap, int opPos)
          Given an operation position, return the end position, i.e.
 int getNextStepPos(int opPos)
          Given a location step position, return the end position, i.e.
 int getOp(int opPos)
          Given an operation position, return the current op.
 int[] getOpMap()
          Get the opcode list that describes the XPath operations.
 java.lang.String getPatternString()
          Return the expression as a string for diagnostics.
 java.lang.String getStepLocalName(int opPosOfStep)
          Get the local name of the step.
 java.lang.String getStepNS(int opPosOfStep)
          Get the namespace of the step.
 int getStepTestType(int opPosOfStep)
          Get the test type of the step, i.e.
 java.lang.Object getToken(int pos)
          Get the XPath as a list of tokens.
 java.lang.Object[] getTokenQueue()
          Get the XPath as a list of tokens.
 int getTokenQueueSize()
          Get size of the token queue.
 java.lang.String toString()
          Return the expression as a string for diagnostics.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_currentPattern

protected java.lang.String m_currentPattern
The current pattern string, for diagnostics purposes

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
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()
Return the expression as a string for diagnostics.

Returns:
The expression string.
Overrides:
toString in class java.lang.Object

getPatternString

public java.lang.String getPatternString()
Return the expression as a string for diagnostics.

Returns:
The expression string.

getTokenQueue

public java.lang.Object[] getTokenQueue()
Get the XPath as a list of tokens.

Returns:
an array of string tokens.

getToken

public java.lang.Object getToken(int pos)
Get the XPath as a list of tokens.

Parameters:
pos - index into token queue.
Returns:
The token, normally a string.

getTokenQueueSize

public int getTokenQueueSize()
Get size of the token queue.

Returns:
The size of the token queue.

getOpMap

public int[] getOpMap()
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.

Returns:
An array of integers that is the opcode list that describes the XPath operations.

getOp

public int getOp(int opPos)
Given an operation position, return the current op.

Parameters:
opPos - index into op map.
Returns:
the op that corresponds to the opPos argument.

getNextOpPos

public int getNextOpPos(int opPos)
Given an operation position, return the end position, i.e. the beginning of the next operation.

Parameters:
opPos - An op position of an operation for which there is a size entry following.
Returns:
position of next operation in m_opMap.

getNextStepPos

public int getNextStepPos(int opPos)
Given a location step position, return the end position, i.e. the beginning of the next step.

Parameters:
opPos - the position of a location step.
Returns:
the position of the next location step.

getNextOpPos

public static int getNextOpPos(int[] opMap,
                               int opPos)
Given an operation position, return the end position, i.e. the beginning of the next operation.

Parameters:
opMap - The operations map.
opPos - index to operation, for which there is a size entry following.
Returns:
position of next operation in m_opMap.

getFirstPredicateOpPos

public int getFirstPredicateOpPos(int opPos)
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);

Parameters:
opPos - position of FROM_stepType op.
Returns:
position of predicate in FROM_stepType structure.

getFirstChildPos

public static int getFirstChildPos(int opPos)
Go to the first child of a given operation.

Parameters:
opPos - position of operation.
Returns:
The position of the first child of the operation.

getArgLength

public int getArgLength(int opPos)
Get the length of an operation.

Parameters:
opPos - The position of the operation in the op map.
Returns:
The size of the operation.

getArgLengthOfStep

public int getArgLengthOfStep(int opPos)
Given a location step, get the length of that step.

Parameters:
opPos - Position of location step in op map.
Returns:
The length of the step.

getFirstChildPosOfStep

public static int getFirstChildPosOfStep(int opPos)
Get the first child position of a given location step.

Parameters:
opPos - Position of location step in the location map.
Returns:
The first child position of the step.

getStepTestType

public int getStepTestType(int opPosOfStep)
Get the test type of the step, i.e. NODETYPE_XXX value.

Parameters:
opPosOfStep - The position of the FROM_XXX step.
Returns:
NODETYPE_XXX value.

getStepNS

public java.lang.String getStepNS(int opPosOfStep)
Get the namespace of the step.

Parameters:
opPosOfStep - The position of the FROM_XXX step.
Returns:
The step's namespace, NodeTest.WILD, or null for null namespace.

getStepLocalName

public java.lang.String getStepLocalName(int opPosOfStep)
Get the local name of the step.

Parameters:
opPosOfStep - The position of the FROM_XXX step.
Returns:
OpCodes.EMPTY, OpCodes.ELEMWILDCARD, or the local name.

Documentation is available at
http://download.oracle.com/docs/cd/E13222_01/wls/docs61

WebLogic classes and methods that do not appear in this reference are not public and are not supported.