当前位置: 首页>>代码示例>>Java>>正文


Java CMNode类代码示例

本文整理汇总了Java中com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode的典型用法代码示例。如果您正苦于以下问题:Java CMNode类的具体用法?Java CMNode怎么用?Java CMNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CMNode类属于com.sun.org.apache.xerces.internal.impl.dtd.models包,在下文中一共展示了CMNode类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: copyNode

import com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode; //导入依赖的package包/类
private CMNode copyNode(CMNode node) {
    int type = node.type();
    // for choice or sequence, copy the two subtrees, and combine them
    if (type == XSModelGroupImpl.MODELGROUP_CHOICE ||
        type == XSModelGroupImpl.MODELGROUP_SEQUENCE) {
        XSCMBinOp bin = (XSCMBinOp)node;
        node = fNodeFactory.getCMBinOpNode(type, copyNode(bin.getLeft()),
                             copyNode(bin.getRight()));
    }
    // for ?+*, copy the subtree, and put it in a new ?+* node
    else if (type == XSParticleDecl.PARTICLE_ZERO_OR_MORE ||
             type == XSParticleDecl.PARTICLE_ONE_OR_MORE ||
             type == XSParticleDecl.PARTICLE_ZERO_OR_ONE) {
        XSCMUniOp uni = (XSCMUniOp)node;
        node = fNodeFactory.getCMUniOpNode(type, copyNode(uni.getChild()));
    }
    // for element/wildcard (leaf), make a new leaf node,
    // with a distinct position
    else if (type == XSParticleDecl.PARTICLE_ELEMENT ||
             type == XSParticleDecl.PARTICLE_WILDCARD) {
        XSCMLeaf leaf = (XSCMLeaf)node;
        node = fNodeFactory.getCMLeafNode(leaf.type(), leaf.getLeaf(), leaf.getParticleId(), fLeafCount++);
    }

    return node;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:CMBuilder.java

示例2: XSCMBinOp

import com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode; //导入依赖的package包/类
public XSCMBinOp(int type, CMNode leftNode, CMNode rightNode)
{
    super(type);

    // Insure that its one of the types we require
    if ((type() != XSModelGroupImpl.MODELGROUP_CHOICE)
    &&  (type() != XSModelGroupImpl.MODELGROUP_SEQUENCE)) {
        throw new RuntimeException("ImplementationMessages.VAL_BST");
    }

    // Store the nodes and init any data that needs it
    fLeftChild = leftNode;
    fRightChild = rightNode;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:XSCMBinOp.java

示例3: XSCMUniOp

import com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode; //导入依赖的package包/类
public XSCMUniOp(int type, CMNode childNode) {
    super(type);

    // Insure that its one of the types we require
    if ((type() != XSParticleDecl.PARTICLE_ZERO_OR_ONE)
    &&  (type() != XSParticleDecl.PARTICLE_ZERO_OR_MORE)
    &&  (type() != XSParticleDecl.PARTICLE_ONE_OR_MORE)) {
        throw new RuntimeException("ImplementationMessages.VAL_UST");
    }

    // Store the node and init any data that needs it
    fChild = childNode;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:XSCMUniOp.java

示例4: XSDFACM

import com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode; //导入依赖的package包/类
/**
  * Constructs a DFA content model.
  *
  * @param syntaxTree    The syntax tree of the content model.
  * @param leafCount     The number of leaves.
  *
  * @exception RuntimeException Thrown if DFA can't be built.
  */

public XSDFACM(CMNode syntaxTree, int leafCount) {

     // Store away our index and pools in members
     fLeafCount = leafCount;

     //
     //  Create some string pool indexes that represent the names of some
     //  magical nodes in the syntax tree.
     //  (already done in static initialization...
     //

     //
     //  Ok, so lets grind through the building of the DFA. This method
     //  handles the high level logic of the algorithm, but it uses a
     //  number of helper classes to do its thing.
     //
     //  In order to avoid having hundreds of references to the error and
     //  string handlers around, this guy and all of his helper classes
     //  just throw a simple exception and we then pass it along.
     //

     if(DEBUG_VALIDATE_CONTENT) {
         XSDFACM.time -= System.currentTimeMillis();
     }

     buildDFA(syntaxTree);

     if(DEBUG_VALIDATE_CONTENT) {
         XSDFACM.time += System.currentTimeMillis();
         System.out.println("DFA build: " + XSDFACM.time + "ms");
     }
 }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:42,代码来源:XSDFACM.java

示例5: postTreeBuildInit

import com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode; //导入依赖的package包/类
/** Post tree build initialization. */
private void postTreeBuildInit(CMNode nodeCur) throws RuntimeException {
    // Set the maximum states on this node
    nodeCur.setMaxStates(fLeafCount);

    XSCMLeaf leaf = null;
    int pos = 0;
    // Recurse as required
    if (nodeCur.type() == XSParticleDecl.PARTICLE_WILDCARD) {
        leaf = (XSCMLeaf)nodeCur;
        pos = leaf.getPosition();
        fLeafList[pos] = leaf;
        fLeafListType[pos] = XSParticleDecl.PARTICLE_WILDCARD;
    }
    else if ((nodeCur.type() == XSModelGroupImpl.MODELGROUP_CHOICE) ||
             (nodeCur.type() == XSModelGroupImpl.MODELGROUP_SEQUENCE)) {
        postTreeBuildInit(((XSCMBinOp)nodeCur).getLeft());
        postTreeBuildInit(((XSCMBinOp)nodeCur).getRight());
    }
    else if (nodeCur.type() == XSParticleDecl.PARTICLE_ZERO_OR_MORE ||
             nodeCur.type() == XSParticleDecl.PARTICLE_ONE_OR_MORE ||
             nodeCur.type() == XSParticleDecl.PARTICLE_ZERO_OR_ONE) {
        postTreeBuildInit(((XSCMUniOp)nodeCur).getChild());
    }
    else if (nodeCur.type() == XSParticleDecl.PARTICLE_ELEMENT) {
        //  Put this node in the leaf list at the current index if its
        //  a non-epsilon leaf.
        leaf = (XSCMLeaf)nodeCur;
        pos = leaf.getPosition();
        fLeafList[pos] = leaf;
        fLeafListType[pos] = XSParticleDecl.PARTICLE_ELEMENT;
    }
    else {
        throw new RuntimeException("ImplementationMessages.VAL_NIICM");
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:37,代码来源:XSDFACM.java

示例6: createDFACM

import com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode; //导入依赖的package包/类
XSCMValidator createDFACM(XSParticleDecl particle) {
    fLeafCount = 0;
    fParticleCount = 0;
    // convert particle tree to CM tree
    CMNode node = useRepeatingLeafNodes(particle) ? buildCompactSyntaxTree(particle) : buildSyntaxTree(particle, true);
    if (node == null)
        return null;
    // build DFA content model from the CM tree
    return new XSDFACM(node, fLeafCount);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:CMBuilder.java

示例7: multiNodes

import com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode; //导入依赖的package包/类
private CMNode multiNodes(CMNode node, int num, boolean copyFirst) {
    if (num == 0) {
        return null;
    }
    if (num == 1) {
        return copyFirst ? copyNode(node) : node;
    }
    int num1 = num/2;
    return fNodeFactory.getCMBinOpNode(XSModelGroupImpl.MODELGROUP_SEQUENCE,
                                       multiNodes(node, num1, copyFirst),
                                       multiNodes(node, num-num1, true));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:CMBuilder.java

示例8: buildCompactSyntaxTree2

import com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode; //导入依赖的package包/类
private CMNode buildCompactSyntaxTree2(XSParticleDecl particle, int minOccurs, int maxOccurs) {
    // Convert element and wildcard particles to leaf nodes. Wrap repeating particles in a CMUniOpNode.
    CMNode nodeRet = null;
    if (minOccurs == 1 && maxOccurs == 1) {
        nodeRet = fNodeFactory.getCMLeafNode(particle.fType, particle.fValue, fParticleCount++, fLeafCount++);
    }
    else if (minOccurs == 0 && maxOccurs == 1) {
        // zero or one
        nodeRet = fNodeFactory.getCMLeafNode(particle.fType, particle.fValue, fParticleCount++, fLeafCount++);
        nodeRet = fNodeFactory.getCMUniOpNode(XSParticleDecl.PARTICLE_ZERO_OR_ONE, nodeRet);
    }
    else if (minOccurs == 0 && maxOccurs==SchemaSymbols.OCCURRENCE_UNBOUNDED) {
        // zero or more
        nodeRet = fNodeFactory.getCMLeafNode(particle.fType, particle.fValue, fParticleCount++, fLeafCount++);
        nodeRet = fNodeFactory.getCMUniOpNode(XSParticleDecl.PARTICLE_ZERO_OR_MORE, nodeRet);
    }
    else if (minOccurs == 1 && maxOccurs==SchemaSymbols.OCCURRENCE_UNBOUNDED) {
        // one or more
        nodeRet = fNodeFactory.getCMLeafNode(particle.fType, particle.fValue, fParticleCount++, fLeafCount++);
        nodeRet = fNodeFactory.getCMUniOpNode(XSParticleDecl.PARTICLE_ONE_OR_MORE, nodeRet);
    }
    else {
        // {n,m}: Instead of expanding this out, create a compound leaf node which carries the
        // occurence information and wrap it in the appropriate CMUniOpNode.
        nodeRet = fNodeFactory.getCMRepeatingLeafNode(particle.fType, particle.fValue, minOccurs, maxOccurs, fParticleCount++, fLeafCount++);
        if (minOccurs == 0) {
            nodeRet = fNodeFactory.getCMUniOpNode(XSParticleDecl.PARTICLE_ZERO_OR_MORE, nodeRet);
        }
        else {
            nodeRet = fNodeFactory.getCMUniOpNode(XSParticleDecl.PARTICLE_ONE_OR_MORE, nodeRet);
        }
    }
    return nodeRet;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:35,代码来源:CMBuilder.java

示例9: XSDFACM

import com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode; //导入依赖的package包/类
/**
  * Constructs a DFA content model.
  *
  * @param syntaxTree    The syntax tree of the content model.
  * @param leafCount     The number of leaves.
  *
  * @exception RuntimeException Thrown if DFA can't be built.
  */

public XSDFACM(CMNode syntaxTree, int leafCount) {

     // Store away our index and pools in members
     fLeafCount = leafCount;
     fIsCompactedForUPA = syntaxTree.isCompactedForUPA();

     //
     //  Create some string pool indexes that represent the names of some
     //  magical nodes in the syntax tree.
     //  (already done in static initialization...
     //

     //
     //  Ok, so lets grind through the building of the DFA. This method
     //  handles the high level logic of the algorithm, but it uses a
     //  number of helper classes to do its thing.
     //
     //  In order to avoid having hundreds of references to the error and
     //  string handlers around, this guy and all of his helper classes
     //  just throw a simple exception and we then pass it along.
     //

     if(DEBUG_VALIDATE_CONTENT) {
         XSDFACM.time -= System.currentTimeMillis();
     }

     buildDFA(syntaxTree);

     if(DEBUG_VALIDATE_CONTENT) {
         XSDFACM.time += System.currentTimeMillis();
         System.out.println("DFA build: " + XSDFACM.time + "ms");
     }
 }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:43,代码来源:XSDFACM.java

示例10: createDFACM

import com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode; //导入依赖的package包/类
XSCMValidator createDFACM(XSParticleDecl particle, boolean forUPA) {
    fLeafCount = 0;
    fParticleCount = 0;
    // convert particle tree to CM tree
    CMNode node = useRepeatingLeafNodes(particle) ? buildCompactSyntaxTree(particle) : buildSyntaxTree(particle, forUPA, true);
    if (node == null)
        return null;
    // build DFA content model from the CM tree
    return new XSDFACM(node, fLeafCount);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:CMBuilder.java


注:本文中的com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。