本文整理汇总了Java中com.sun.org.apache.xpath.internal.compiler.Compiler类的典型用法代码示例。如果您正苦于以下问题:Java Compiler类的具体用法?Java Compiler怎么用?Java Compiler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Compiler类属于com.sun.org.apache.xpath.internal.compiler包,在下文中一共展示了Compiler类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: BasicTestIterator
import com.sun.org.apache.xpath.internal.compiler.Compiler; //导入依赖的package包/类
/**
* Create a LocPathIterator object, including creation
* of step walkers from the opcode list, and call back
* into the Compiler to create predicate expressions.
*
* @param compiler The Compiler which is creating
* this expression.
* @param opPos The position of this iterator in the
* opcode list from the compiler.
*
* @throws javax.xml.transform.TransformerException
*/
protected BasicTestIterator(Compiler compiler, int opPos, int analysis)
throws javax.xml.transform.TransformerException
{
super(compiler, opPos, analysis, false);
int firstStepPos = OpMap.getFirstChildPos(opPos);
int whatToShow = compiler.getWhatToShow(firstStepPos);
if ((0 == (whatToShow
& (DTMFilter.SHOW_ATTRIBUTE
| DTMFilter.SHOW_NAMESPACE
| DTMFilter.SHOW_ELEMENT
| DTMFilter.SHOW_PROCESSING_INSTRUCTION)))
|| (whatToShow == DTMFilter.SHOW_ALL))
initNodeTest(whatToShow);
else
{
initNodeTest(whatToShow, compiler.getStepNS(firstStepPos),
compiler.getStepLocalName(firstStepPos));
}
initPredicateInfo(compiler, firstStepPos);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:35,代码来源:BasicTestIterator.java
示例2: initPredicateInfo
import com.sun.org.apache.xpath.internal.compiler.Compiler; //导入依赖的package包/类
/**
* Init predicate info.
*
* @param compiler The Compiler object that has information about this
* walker in the op map.
* @param opPos The op code position of this location step.
*
* @throws javax.xml.transform.TransformerException
*/
protected void initPredicateInfo(Compiler compiler, int opPos)
throws javax.xml.transform.TransformerException
{
int pos = compiler.getFirstPredicateOpPos(opPos);
if(pos > 0)
{
m_predicates = compiler.getCompiledPredicates(pos);
if(null != m_predicates)
{
for(int i = 0; i < m_predicates.length; i++)
{
m_predicates[i].exprSetParent(this);
}
}
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:PredicatedNodeTest.java
示例3: loadOneWalker
import com.sun.org.apache.xpath.internal.compiler.Compiler; //导入依赖的package包/类
/**
* This method is for building an array of possible levels
* where the target element(s) could be found for a match.
* @param lpi The owning location path iterator.
* @param compiler non-null reference to compiler object that has processed
* the XPath operations into an opcode map.
* @param stepOpCodePos The opcode position for the step.
*
* @return non-null AxesWalker derivative.
*
* @throws javax.xml.transform.TransformerException
* @xsl.usage advanced
*/
static AxesWalker loadOneWalker(
WalkingIterator lpi, Compiler compiler, int stepOpCodePos)
throws javax.xml.transform.TransformerException
{
AxesWalker firstWalker = null;
int stepType = compiler.getOp(stepOpCodePos);
if (stepType != OpCodes.ENDOP)
{
// m_axesWalkers = new AxesWalker[1];
// As we unwind from the recursion, create the iterators.
firstWalker = createDefaultWalker(compiler, stepType, lpi, 0);
firstWalker.init(compiler, stepOpCodePos, stepType);
}
return firstWalker;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:34,代码来源:WalkerFactory.java
示例4: analyzePredicate
import com.sun.org.apache.xpath.internal.compiler.Compiler; //导入依赖的package包/类
/**
* Analyze a step and give information about it's predicates. Right now this
* just returns true or false if the step has a predicate.
*
* @param compiler non-null reference to compiler object that has processed
* the XPath operations into an opcode map.
* @param opPos The opcode position for the step.
* @param stepType The type of step, one of OP_GROUP, etc.
*
* @return true if step has a predicate.
*
* @throws javax.xml.transform.TransformerException
*/
static boolean analyzePredicate(Compiler compiler, int opPos, int stepType)
throws javax.xml.transform.TransformerException
{
int argLen;
switch (stepType)
{
case OpCodes.OP_VARIABLE :
case OpCodes.OP_EXTFUNCTION :
case OpCodes.OP_FUNCTION :
case OpCodes.OP_GROUP :
argLen = compiler.getArgLength(opPos);
break;
default :
argLen = compiler.getArgLengthOfStep(opPos);
}
int pos = compiler.getFirstPredicateOpPos(opPos);
int nPredicates = compiler.countPredicates(pos);
return (nPredicates > 0) ? true : false;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:37,代码来源:WalkerFactory.java
示例5: OneStepIterator
import com.sun.org.apache.xpath.internal.compiler.Compiler; //导入依赖的package包/类
/**
* Create a OneStepIterator object.
*
* @param compiler A reference to the Compiler that contains the op map.
* @param opPos The position within the op map, which contains the
* location path expression for this itterator.
*
* @throws javax.xml.transform.TransformerException
*/
OneStepIterator(Compiler compiler, int opPos, int analysis)
throws javax.xml.transform.TransformerException
{
super(compiler, opPos, analysis);
int firstStepPos = OpMap.getFirstChildPos(opPos);
m_axis = WalkerFactory.getAxisFromStep(compiler, firstStepPos);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:OneStepIterator.java
示例6: loadWalkers
import com.sun.org.apache.xpath.internal.compiler.Compiler; //导入依赖的package包/类
/**
* This method is for building an array of possible levels
* where the target element(s) could be found for a match.
* @param lpi The owning location path iterator object.
* @param compiler non-null reference to compiler object that has processed
* the XPath operations into an opcode map.
* @param stepOpCodePos The opcode position for the step.
* @param stepIndex The top-level step index withing the iterator.
*
* @return non-null AxesWalker derivative.
*
* @throws javax.xml.transform.TransformerException
* @xsl.usage advanced
*/
static AxesWalker loadWalkers(
WalkingIterator lpi, Compiler compiler, int stepOpCodePos, int stepIndex)
throws javax.xml.transform.TransformerException
{
int stepType;
AxesWalker firstWalker = null;
AxesWalker walker, prevWalker = null;
int analysis = analyze(compiler, stepOpCodePos, stepIndex);
while (OpCodes.ENDOP != (stepType = compiler.getOp(stepOpCodePos)))
{
walker = createDefaultWalker(compiler, stepOpCodePos, lpi, analysis);
walker.init(compiler, stepOpCodePos, stepType);
walker.exprSetParent(lpi);
// walker.setAnalysis(analysis);
if (null == firstWalker)
{
firstWalker = walker;
}
else
{
prevWalker.setNextWalker(walker);
walker.setPrevWalker(prevWalker);
}
prevWalker = walker;
stepOpCodePos = compiler.getNextStepPos(stepOpCodePos);
if (stepOpCodePos < 0)
break;
}
return firstWalker;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:53,代码来源:WalkerFactory.java
示例7: functionProximateOrContainsProximate
import com.sun.org.apache.xpath.internal.compiler.Compiler; //导入依赖的package包/类
static boolean functionProximateOrContainsProximate(Compiler compiler,
int opPos)
{
int endFunc = opPos + compiler.getOp(opPos + 1) - 1;
opPos = OpMap.getFirstChildPos(opPos);
int funcID = compiler.getOp(opPos);
// System.out.println("funcID: "+funcID);
// System.out.println("opPos: "+opPos);
// System.out.println("endFunc: "+endFunc);
switch(funcID)
{
case FunctionTable.FUNC_LAST:
case FunctionTable.FUNC_POSITION:
return true;
default:
opPos++;
int i = 0;
for (int p = opPos; p < endFunc; p = compiler.getNextOpPos(p), i++)
{
int innerExprOpPos = p+2;
int argOp = compiler.getOp(innerExprOpPos);
boolean prox = isProximateInnerExpr(compiler, innerExprOpPos);
if(prox)
return true;
}
}
return false;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:WalkerFactory.java
示例8: isProximateInnerExpr
import com.sun.org.apache.xpath.internal.compiler.Compiler; //导入依赖的package包/类
static boolean isProximateInnerExpr(Compiler compiler, int opPos)
{
int op = compiler.getOp(opPos);
int innerExprOpPos = opPos+2;
switch(op)
{
case OpCodes.OP_ARGUMENT:
if(isProximateInnerExpr(compiler, innerExprOpPos))
return true;
break;
case OpCodes.OP_VARIABLE:
case OpCodes.OP_NUMBERLIT:
case OpCodes.OP_LITERAL:
case OpCodes.OP_LOCATIONPATH:
break; // OK
case OpCodes.OP_FUNCTION:
boolean isProx = functionProximateOrContainsProximate(compiler, opPos);
if(isProx)
return true;
break;
case OpCodes.OP_GT:
case OpCodes.OP_GTE:
case OpCodes.OP_LT:
case OpCodes.OP_LTE:
case OpCodes.OP_EQUALS:
int leftPos = OpMap.getFirstChildPos(op);
int rightPos = compiler.getNextOpPos(leftPos);
isProx = isProximateInnerExpr(compiler, leftPos);
if(isProx)
return true;
isProx = isProximateInnerExpr(compiler, rightPos);
if(isProx)
return true;
break;
default:
return true; // be conservative...
}
return false;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:40,代码来源:WalkerFactory.java
示例9: OneStepIteratorForward
import com.sun.org.apache.xpath.internal.compiler.Compiler; //导入依赖的package包/类
/**
* Create a OneStepIterator object.
*
* @param compiler A reference to the Compiler that contains the op map.
* @param opPos The position within the op map, which contains the
* location path expression for this itterator.
*
* @throws javax.xml.transform.TransformerException
*/
OneStepIteratorForward(Compiler compiler, int opPos, int analysis)
throws javax.xml.transform.TransformerException
{
super(compiler, opPos, analysis);
int firstStepPos = OpMap.getFirstChildPos(opPos);
m_axis = WalkerFactory.getAxisFromStep(compiler, firstStepPos);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:OneStepIteratorForward.java
示例10: XPath
import com.sun.org.apache.xpath.internal.compiler.Compiler; //导入依赖的package包/类
/**
* Construct an XPath object.
*
* (Needs review -sc) This method initializes an XPathParser/
* Compiler and compiles the expression.
* @param exprString The XPath expression.
* @param locator The location of the expression, may be null.
* @param prefixResolver A prefix resolver to use to resolve prefixes to
* namespace URIs.
* @param type one of {@link #SELECT} or {@link #MATCH}.
* @param errorListener The error listener, or null if default should be used.
*
* @throws javax.xml.transform.TransformerException if syntax or other error.
*/
public XPath(
String exprString, SourceLocator locator, PrefixResolver prefixResolver, int type,
ErrorListener errorListener)
throws javax.xml.transform.TransformerException
{
initFunctionTable();
if(null == errorListener)
errorListener = new com.sun.org.apache.xml.internal.utils.DefaultErrorHandler();
m_patternString = exprString;
XPathParser parser = new XPathParser(errorListener, locator);
Compiler compiler = new Compiler(errorListener, locator, m_funcTable);
if (SELECT == type)
parser.initXPath(compiler, exprString, prefixResolver);
else if (MATCH == type)
parser.initMatchPattern(compiler, exprString, prefixResolver);
else
throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_CANNOT_DEAL_XPATH_TYPE, new Object[]{Integer.toString(type)})); //"Can not deal with XPath type: " + type);
// System.out.println("----------------");
Expression expr = compiler.compile(0);
// System.out.println("expr: "+expr);
this.setExpression(expr);
if((null != locator) && locator instanceof ExpressionNode)
{
expr.exprSetParent((ExpressionNode)locator);
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:48,代码来源:XPath.java
注:本文中的com.sun.org.apache.xpath.internal.compiler.Compiler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论