public CMNode getCMUniOpNode(int type, CMNode childNode) { nodeCountCheck(); return new XSCMUniOp(type, childNode) ; }
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; }
System.out.println(nodeCur.lastPos().toString()); dumpTree(((XSCMUniOp)nodeCur).getChild(), level+1); break;
nodeCur.type() == XSParticleDecl.PARTICLE_ONE_OR_MORE || nodeCur.type() == XSParticleDecl.PARTICLE_ZERO_OR_ONE) { postTreeBuildInit(((XSCMUniOp)nodeCur).getChild());
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; }
public boolean isNullable() { // // For debugging purposes, make sure we got rid of all non '*' // repetitions. Otherwise, '*' style nodes are always nullable. // if (type() == XSParticleDecl.PARTICLE_ONE_OR_MORE) return fChild.isNullable(); else return true; }