本文整理汇总了Java中net.sf.saxon.om.AxisInfo.ANCESTOR_OR_SELF属性的典型用法代码示例。如果您正苦于以下问题:Java AxisInfo.ANCESTOR_OR_SELF属性的具体用法?Java AxisInfo.ANCESTOR_OR_SELF怎么用?Java AxisInfo.ANCESTOR_OR_SELF使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.sf.saxon.om.AxisInfo
的用法示例。
在下文中一共展示了AxisInfo.ANCESTOR_OR_SELF属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: iterateAxis
/**
* Determines axis iteration algorithm. Throws {@code UnsupportedOperationException} in case,
* when there is no axis iterator for given axisNumber.
* @param axisNumber element from {@code AxisInfo}
* @return {@code AxisIterator} object
*/
@Override
public AxisIterator iterateAxis(byte axisNumber) {
final AxisIterator result;
switch (axisNumber) {
case AxisInfo.ANCESTOR:
case AxisInfo.ATTRIBUTE:
case AxisInfo.PARENT:
result = EmptyIterator.OfNodes.THE_INSTANCE;
break;
case AxisInfo.ANCESTOR_OR_SELF:
case AxisInfo.SELF:
result = SingleNodeIterator.makeIterator(this);
break;
case AxisInfo.CHILD:
if (hasChildNodes()) {
result = new ArrayIterator.OfNodes(
getChildren().toArray(new AbstractNode[getChildren().size()]));
}
else {
result = EmptyIterator.OfNodes.THE_INSTANCE;
}
break;
case AxisInfo.DESCENDANT:
if (hasChildNodes()) {
result = new Navigator.DescendantEnumeration(this, false, true);
}
else {
result = EmptyIterator.OfNodes.THE_INSTANCE;
}
break;
case AxisInfo.DESCENDANT_OR_SELF:
result = new Navigator.DescendantEnumeration(this, true, true);
break;
default:
throw throwUnsupportedOperationException();
}
return result;
}
示例2: getAxisType
private AxisType getAxisType(byte axis) {
switch (axis) {
case AxisInfo.ANCESTOR:
return AxisType.ANCESTOR;
case AxisInfo.ANCESTOR_OR_SELF:
return AxisType.ANCESTOR_OR_SELF;
case AxisInfo.ATTRIBUTE:
return AxisType.ATTRIBUTE;
case AxisInfo.CHILD:
return AxisType.CHILD;
case AxisInfo.DESCENDANT:
return AxisType.DESCENDANT;
case AxisInfo.DESCENDANT_OR_SELF:
return AxisType.DESCENDANT_OR_SELF;
case AxisInfo.FOLLOWING:
return AxisType.FOLLOWING;
case AxisInfo.FOLLOWING_SIBLING:
return AxisType.FOLLOWING_SIBLING;
case AxisInfo.NAMESPACE:
return AxisType.NAMESPACE;
case AxisInfo.PARENT:
return AxisType.PARENT;
case AxisInfo.PRECEDING:
return AxisType.PRECEDING;
case AxisInfo.PRECEDING_OR_ANCESTOR:
return null; // ??
case AxisInfo.PRECEDING_SIBLING:
return AxisType.PRECEDING_SIBLING;
case AxisInfo.SELF:
return AxisType.SELF;
}
return null;
}
示例3: iterateAxis
/**
* Determines axis iteration algorithm. Throws {@code UnsupportedOperationException} in case,
* when there is no axis iterator for given axisNumber.
*
* @param axisNumber element from {@code AxisInfo}
* @return {@code AxisIterator} object
*/
@Override
public AxisIterator iterateAxis(byte axisNumber) {
final AxisIterator result;
switch (axisNumber) {
case AxisInfo.ANCESTOR:
result = new Navigator.AncestorEnumeration(this, false);
break;
case AxisInfo.ANCESTOR_OR_SELF:
result = new Navigator.AncestorEnumeration(this, true);
break;
case AxisInfo.ATTRIBUTE:
if (attributes == null) {
result = EmptyIterator.OfNodes.THE_INSTANCE;
}
else {
result = new ArrayIterator.OfNodes(attributes);
}
break;
case AxisInfo.CHILD:
if (hasChildNodes()) {
result = new ArrayIterator.OfNodes(
getChildren().toArray(new AbstractNode[getChildren().size()]));
}
else {
result = EmptyIterator.OfNodes.THE_INSTANCE;
}
break;
case AxisInfo.DESCENDANT:
if (hasChildNodes()) {
result = new Navigator.DescendantEnumeration(this, false, true);
}
else {
result = EmptyIterator.OfNodes.THE_INSTANCE;
}
break;
case AxisInfo.DESCENDANT_OR_SELF:
result = new Navigator.DescendantEnumeration(this, true, true);
break;
case AxisInfo.PARENT:
result = SingleNodeIterator.makeIterator(parent);
break;
case AxisInfo.SELF:
result = SingleNodeIterator.makeIterator(this);
break;
default:
throw throwUnsupportedOperationException();
}
return result;
}
示例4: validateColumnForStreaming
private boolean validateColumnForStreaming(AnalysisRecord record,
XMLColumn xmlColumn, PathMapArc arc) {
boolean ancestor = false;
LinkedList<PathMapArc> arcStack = new LinkedList<PathMapArc>();
arcStack.add(arc);
while (!arcStack.isEmpty()) {
PathMapArc current = arcStack.removeFirst();
byte axis = current.getAxis();
if (ancestor) {
if (current.getTarget().isReturnable()) {
if (axis != AxisInfo.NAMESPACE && axis != AxisInfo.ATTRIBUTE) {
if (record.recordAnnotations()) {
record.addAnnotation(XQUERY_PLANNING, "The column path contains an invalid reverse axis " + xmlColumn.getPath(), "Document streaming will not be used", Priority.MEDIUM); //$NON-NLS-1$ //$NON-NLS-2$
}
return false;
}
}
if (!isValidAncestorAxis[axis]) {
if (record.recordAnnotations()) {
record.addAnnotation(XQUERY_PLANNING, "The column path contains an invalid reverse axis " + xmlColumn.getPath(), "Document streaming will not be used", Priority.MEDIUM); //$NON-NLS-1$ //$NON-NLS-2$
}
return false;
}
} else if (!AxisInfo.isSubtreeAxis[axis]) {
if (axis == AxisInfo.PARENT
|| axis == AxisInfo.ANCESTOR
|| axis == AxisInfo.ANCESTOR_OR_SELF) {
if (current.getTarget().isReturnable()) {
if (record.recordAnnotations()) {
record.addAnnotation(XQUERY_PLANNING, "The column path contains an invalid reverse axis " + xmlColumn.getPath(), "Document streaming will not be used", Priority.MEDIUM); //$NON-NLS-1$ //$NON-NLS-2$
}
return false;
}
ancestor = true;
} else {
if (record.recordAnnotations()) {
record.addAnnotation(XQUERY_PLANNING, "The column path may not reference an ancestor or subtree " + xmlColumn.getPath(), "Document streaming will not be used", Priority.MEDIUM); //$NON-NLS-1$ //$NON-NLS-2$
}
return false;
}
}
for (PathMapArc pathMapArc : current.getTarget().getArcs()) {
arcStack.add(pathMapArc);
}
}
return true;
}