本文整理汇总了Java中com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type.Node方法的典型用法代码示例。如果您正苦于以下问题:Java Type.Node方法的具体用法?Java Type.Node怎么用?Java Type.Node使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type
的用法示例。
在下文中一共展示了Type.Node方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: typeCheck
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; //导入方法依赖的package包/类
/**
* Check that we either have no parameters or one parameter that is
* either a node or a node-set.
*/
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
// Check the argument type (if any)
switch(argumentCount()) {
case 0:
_paramType = Type.Node;
break;
case 1:
_paramType = _param.typeCheck(stable);
break;
default:
throw new TypeCheckError(this);
}
// The argument has to be a node, a node-set or a node reference
if ((_paramType != Type.NodeSet) &&
(_paramType != Type.Node) &&
(_paramType != Type.Reference)) {
throw new TypeCheckError(this);
}
return (_type = Type.String);
}
示例2: translate
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; //导入方法依赖的package包/类
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
final InstructionList il = methodGen.getInstructionList();
Type targ;
if (argumentCount() == 0) {
il.append(methodGen.loadContextNode());
targ = Type.Node;
}
else {
final Expression arg = argument();
arg.translate(classGen, methodGen);
arg.startIterator(classGen, methodGen);
targ = arg.getType();
}
if (!targ.identicalTo(Type.Real)) {
targ.translateTo(classGen, methodGen, Type.Real);
}
}
示例3: typeCheck
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; //导入方法依赖的package包/类
/**
* Type checking a cast expression amounts to verifying that the
* type conversion is legal. Cast expressions are created during
* type checking, but typeCheck() is usually not called on them.
* As a result, this method is called from the constructor.
*/
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
Type tleft = _left.getType();
if (tleft == null) {
tleft = _left.typeCheck(stable);
}
if (tleft instanceof NodeType) {
tleft = Type.Node; // multiple instances
}
else if (tleft instanceof ResultTreeType) {
tleft = Type.ResultTree; // multiple instances
}
if (InternalTypeMap.maps(tleft, _type) != null) {
return _type;
}
// throw new TypeCheckError(this);
throw new TypeCheckError(new ErrorMsg(
ErrorMsg.DATA_CONVERSION_ERR, tleft.toString(), _type.toString()));
}
示例4: typeCheck
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; //导入方法依赖的package包/类
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
Type type = _select.typeCheck(stable);
// Prefer to handle the value as a node; fall back to String, otherwise
if (type != null && !type.identicalTo(Type.Node)) {
/***
*** %HZ% Would like to treat result-tree fragments in the same
*** %HZ% way as node sets for value-of, but that's running into
*** %HZ% some snags. Instead, they'll be converted to String
if (type.identicalTo(Type.ResultTree)) {
_select = new CastExpr(new CastExpr(_select, Type.NodeSet),
Type.Node);
} else
***/
if (type.identicalTo(Type.NodeSet)) {
_select = new CastExpr(_select, Type.Node);
} else {
_isString = true;
if (!type.identicalTo(Type.String)) {
_select = new CastExpr(_select, Type.String);
}
_isString = true;
}
}
return Type.Void;
}
示例5: translate
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; //导入方法依赖的package包/类
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
final InstructionList il = methodGen.getInstructionList();
Type targ;
if (argumentCount() == 0) {
il.append(methodGen.loadContextNode());
targ = Type.Node;
}
else {
final Expression arg = argument();
arg.translate(classGen, methodGen);
arg.startIterator(classGen, methodGen);
targ = arg.getType();
}
if (!targ.identicalTo(Type.String)) {
targ.translateTo(classGen, methodGen, Type.String);
}
}
示例6: translate
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; //导入方法依赖的package包/类
/**
* Translate the code required for getting the node for which the
* QName, local-name or namespace URI should be extracted.
*/
public void translate(ClassGenerator classGen,
MethodGenerator methodGen) {
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
il.append(methodGen.loadDOM());
// Function was called with no parameters
if (argumentCount() == 0) {
il.append(methodGen.loadContextNode());
}
// Function was called with node parameter
else if (_paramType == Type.Node) {
_param.translate(classGen, methodGen);
}
else if (_paramType == Type.Reference) {
_param.translate(classGen, methodGen);
il.append(new INVOKESTATIC(cpg.addMethodref
(BASIS_LIBRARY_CLASS,
"referenceToNodeSet",
"("
+ OBJECT_SIG
+ ")"
+ NODE_ITERATOR_SIG)));
il.append(methodGen.nextNode());
}
// Function was called with node-set parameter
else {
_param.translate(classGen, methodGen);
_param.startIterator(classGen, methodGen);
il.append(methodGen.nextNode());
}
}
示例7: typeCheck
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; //导入方法依赖的package包/类
/**
* Type check this step. The abbreviated steps '.' and '@attr' are
* assigned type node if they have no predicates. All other steps
* have type node-set.
*/
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
// Save this value for later - important for testing for special
// combinations of steps and patterns than can be optimised
_hadPredicates = hasPredicates();
// Special case for '.'
// in the case where '.' has a context such as book/.
// or .[false()] we can not optimize the nodeset to a single node.
if (isAbbreviatedDot()) {
_type = (hasParentPattern() || hasPredicates() || hasParentLocationPath()) ?
Type.NodeSet : Type.Node;
}
else {
_type = Type.NodeSet;
}
// Type check all predicates (expressions applied to the step)
if (_predicates != null) {
final int n = _predicates.size();
for (int i = 0; i < n; i++) {
final Expression pred = (Expression)_predicates.elementAt(i);
pred.typeCheck(stable);
}
}
// Return either Type.Node or Type.NodeSet
return _type;
}