本文整理汇总了Java中com.sun.org.apache.xerces.internal.impl.dtd.XMLContentSpec.CONTENTSPECNODE_SEQ属性的典型用法代码示例。如果您正苦于以下问题:Java XMLContentSpec.CONTENTSPECNODE_SEQ属性的具体用法?Java XMLContentSpec.CONTENTSPECNODE_SEQ怎么用?Java XMLContentSpec.CONTENTSPECNODE_SEQ使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.sun.org.apache.xerces.internal.impl.dtd.XMLContentSpec
的用法示例。
在下文中一共展示了XMLContentSpec.CONTENTSPECNODE_SEQ属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: calcFirstPos
protected void calcFirstPos(CMStateSet toSet)
{
if (type() == XMLContentSpec.CONTENTSPECNODE_CHOICE)
{
// Its the the union of the first positions of our children.
toSet.setTo(fLeftChild.firstPos());
toSet.union(fRightChild.firstPos());
}
else if (type() == XMLContentSpec.CONTENTSPECNODE_SEQ)
{
//
// If our left child is nullable, then its the union of our
// children's first positions. Else is our left child's first
// positions.
//
toSet.setTo(fLeftChild.firstPos());
if (fLeftChild.isNullable())
toSet.union(fRightChild.firstPos());
}
else
{
throw new RuntimeException("ImplementationMessages.VAL_BST");
}
}
示例2: calcLastPos
protected void calcLastPos(CMStateSet toSet)
{
if (type() == XMLContentSpec.CONTENTSPECNODE_CHOICE)
{
// Its the the union of the first positions of our children.
toSet.setTo(fLeftChild.lastPos());
toSet.union(fRightChild.lastPos());
}
else if (type() == XMLContentSpec.CONTENTSPECNODE_SEQ)
{
//
// If our right child is nullable, then its the union of our
// children's last positions. Else is our right child's last
// positions.
//
toSet.setTo(fRightChild.lastPos());
if (fRightChild.isNullable())
toSet.union(fLeftChild.lastPos());
}
else
{
throw new RuntimeException("ImplementationMessages.VAL_BST");
}
}
示例3: CMBinOp
public CMBinOp(int type, CMNode leftNode, CMNode rightNode)
{
super(type);
// Insure that its one of the types we require
if ((type() != XMLContentSpec.CONTENTSPECNODE_CHOICE)
&& (type() != XMLContentSpec.CONTENTSPECNODE_SEQ))
{
throw new RuntimeException("ImplementationMessages.VAL_BST");
}
// Store the nodes and init any data that needs it
fLeftChild = leftNode;
fRightChild = rightNode;
}
示例4: isNullable
public boolean isNullable()
{
//
// If its an alternation, then if either child is nullable then
// this node is nullable. If its a concatenation, then both of
// them have to be nullable.
//
if (type() == XMLContentSpec.CONTENTSPECNODE_CHOICE)
return (fLeftChild.isNullable() || fRightChild.isNullable());
else if (type() == XMLContentSpec.CONTENTSPECNODE_SEQ)
return (fLeftChild.isNullable() && fRightChild.isNullable());
else
throw new RuntimeException("ImplementationMessages.VAL_BST");
}
示例5: dumpTree
/**
* Dumps the tree of the current node to standard output.
*
* @param nodeCur The current node.
* @param level The maximum levels to output.
*
* @exception CMException Thrown on error.
*/
private void dumpTree(CMNode nodeCur, int level)
{
for (int index = 0; index < level; index++)
System.out.print(" ");
int type = nodeCur.type();
if ((type == XMLContentSpec.CONTENTSPECNODE_CHOICE)
|| (type == XMLContentSpec.CONTENTSPECNODE_SEQ))
{
if (type == XMLContentSpec.CONTENTSPECNODE_CHOICE)
System.out.print("Choice Node ");
else
System.out.print("Seq Node ");
if (nodeCur.isNullable())
System.out.print("Nullable ");
System.out.print("firstPos=");
System.out.print(nodeCur.firstPos().toString());
System.out.print(" lastPos=");
System.out.println(nodeCur.lastPos().toString());
dumpTree(((CMBinOp)nodeCur).getLeft(), level+1);
dumpTree(((CMBinOp)nodeCur).getRight(), level+1);
}
else if (nodeCur.type() == XMLContentSpec.CONTENTSPECNODE_ZERO_OR_MORE)
{
System.out.print("Rep Node ");
if (nodeCur.isNullable())
System.out.print("Nullable ");
System.out.print("firstPos=");
System.out.print(nodeCur.firstPos().toString());
System.out.print(" lastPos=");
System.out.println(nodeCur.lastPos().toString());
dumpTree(((CMUniOp)nodeCur).getChild(), level+1);
}
else if (nodeCur.type() == XMLContentSpec.CONTENTSPECNODE_LEAF)
{
System.out.print
(
"Leaf: (pos="
+ ((CMLeaf)nodeCur).getPosition()
+ "), "
+ ((CMLeaf)nodeCur).getElement()
+ "(elemIndex="
+ ((CMLeaf)nodeCur).getElement()
+ ") "
);
if (nodeCur.isNullable())
System.out.print(" Nullable ");
System.out.print("firstPos=");
System.out.print(nodeCur.firstPos().toString());
System.out.print(" lastPos=");
System.out.println(nodeCur.lastPos().toString());
}
else
{
throw new RuntimeException("ImplementationMessages.VAL_NIICM");
}
}
示例6: postTreeBuildInit
/** Post tree build initialization. */
private int postTreeBuildInit(CMNode nodeCur, int curIndex)
{
// Set the maximum states on this node
nodeCur.setMaxStates(fLeafCount);
// Recurse as required
if ((nodeCur.type() & 0x0f) == XMLContentSpec.CONTENTSPECNODE_ANY ||
(nodeCur.type() & 0x0f) == XMLContentSpec.CONTENTSPECNODE_ANY_LOCAL ||
(nodeCur.type() & 0x0f) == XMLContentSpec.CONTENTSPECNODE_ANY_OTHER) {
// REVISIT: Don't waste these structures.
QName qname = new QName(null, null, null, ((CMAny)nodeCur).getURI());
fLeafList[curIndex] = new CMLeaf(qname, ((CMAny)nodeCur).getPosition());
fLeafListType[curIndex] = nodeCur.type();
curIndex++;
}
else if ((nodeCur.type() == XMLContentSpec.CONTENTSPECNODE_CHOICE)
|| (nodeCur.type() == XMLContentSpec.CONTENTSPECNODE_SEQ))
{
curIndex = postTreeBuildInit(((CMBinOp)nodeCur).getLeft(), curIndex);
curIndex = postTreeBuildInit(((CMBinOp)nodeCur).getRight(), curIndex);
}
else if (nodeCur.type() == XMLContentSpec.CONTENTSPECNODE_ZERO_OR_MORE
|| nodeCur.type() == XMLContentSpec.CONTENTSPECNODE_ONE_OR_MORE
|| nodeCur.type() == XMLContentSpec.CONTENTSPECNODE_ZERO_OR_ONE)
{
curIndex = postTreeBuildInit(((CMUniOp)nodeCur).getChild(), curIndex);
}
else if (nodeCur.type() == XMLContentSpec.CONTENTSPECNODE_LEAF)
{
//
// Put this node in the leaf list at the current index if its
// a non-epsilon leaf.
//
final QName node = ((CMLeaf)nodeCur).getElement();
if (node.localpart != fEpsilonString) {
fLeafList[curIndex] = (CMLeaf)nodeCur;
fLeafListType[curIndex] = XMLContentSpec.CONTENTSPECNODE_LEAF;
curIndex++;
}
}
else
{
throw new RuntimeException("ImplementationMessages.VAL_NIICM: type="+nodeCur.type());
}
return curIndex;
}