XSCMValidator createDFACM(XSParticleDecl particle, boolean forUPA, XSOpenContentDecl openContent) { fLeafCount = 0; fParticleCount = 0; // convert particle tree to CM tree CMNode node = useRepeatingLeafNodes(particle) ? buildCompactSyntaxTree(particle) : buildSyntaxTree(particle, forUPA); if (node == null) return null; // build DFA content model from the CM tree return new XSDFACM(node, fLeafCount, fSchemaVersion, openContent); }
public CMNode getCMRepeatingLeafNode(int type, Object leaf, int minOccurs, int maxOccurs, int id, int position) { nodeCountCheck(); return new XSCMRepeatingLeaf(type, leaf, minOccurs, maxOccurs, id, position); }
public CMNode getCMLeafNode(int type, Object leaf, int id, int position) { nodeCountCheck(); return new XSCMLeaf(type, leaf, id, position) ; }
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)); }
public CMNode getCMBinOpNode(int type, CMNode leftNode, CMNode rightNode) { nodeCountCheck() ; return new XSCMBinOp(type, leftNode, rightNode) ; }
public CMNode getCMUniOpNode(int type, CMNode childNode) { nodeCountCheck(); return new XSCMUniOp(type, childNode) ; }
XSCMValidator createAllCM(XSParticleDecl particle) { if (particle.fMaxOccurs == 0) return null; // get the model group, and add all children of it to the content model XSModelGroupImpl group = (XSModelGroupImpl)particle.fValue; // create an all content model. the parameter indicates whether // the <all> itself is optional XSAllCM allContent = new XSAllCM(particle.fMinOccurs == 0, group.fParticleCount, fSchemaVersion); for (int i = 0; i < group.fParticleCount; i++) { // add the element decl to the all content model allContent.addElement((XSElementDecl)group.fParticles[i].fValue, group.fParticles[i].fMinOccurs == 0); } return allContent; }
public synchronized XSCMValidator getContentModel(CMBuilder cmBuilder, boolean forUPA) { if (fCMValidator == null) { if (forUPA) { if (fUPACMValidator == null) { fUPACMValidator = cmBuilder.getContentModel(this, true); if (fUPACMValidator != null && !fUPACMValidator.isCompactedForUPA()) { fCMValidator = fUPACMValidator; } } return fUPACMValidator; } else { fCMValidator = cmBuilder.getContentModel(this, false); } } return fCMValidator; }
protected void groupSubsumption(XSParticleDecl dParticle, XSParticleDecl bParticle, XSGrammarBucket grammarBucket, SubstitutionGroupHandler SGHandler, CMBuilder cmBuilder, XMLErrorReporter errorReporter, String dName, SimpleLocator locator) { // When we get here, particles are not null. Neither are content models. XSCMValidator cmd = cmBuilder.getContentModel(dParticle); XSCMValidator cmb = cmBuilder.getContentModel(bParticle); if (!new XS11CMRestriction(cmb, cmd, SGHandler, grammarBucket, cmBuilder, this).check()) { reportSchemaError(errorReporter, locator, "src-redefine.6.2.2", new Object[]{dName, ""}); } }
private Boolean checkAllEmpty() { // If base (empty) has an open content, turn it into an "all". int[] idx = new int[]{-1}; if (base.nextWildcardTransition(b, bn, idx) != null) { base = new XS11AllCM(false, 0, null, ((XSEmptyCM)base).getOpenContent()); return null; } // Base allows nothing. Derived must be empty too. return Boolean.valueOf(derived.nextElementTransition(d, dn, idx) == null && derived.nextWildcardTransition(d, dn, idx) == null); }
public Occurence (XSCMRepeatingLeaf leaf, int elemIndex) { minOccurs = leaf.getMinOccurs(); maxOccurs = leaf.getMaxOccurs(); this.elemIndex = elemIndex; } public String toString() {
public XSWildcardDecl nextWildcardTransition(int[] s, int[] sn, int[] index) { int idx = index[0] == -1 ? fNumElements : index[0] + 1; for (; idx < fNumTotal; idx++) { if (isAllowedTransition(s, sn, idx)) { index[0] = idx; return fWildcards[idx]; } } if (idx == fNumTotal && isOpenContentAllowed(s, sn)) { index[0] = fNumTotal; return fOpenContent.fWildcard; } index[0] = -1; return null; } private boolean isAllowedTransition(int[] s, int[] sn, int index) {
public XSWildcardDecl nextWildcardTransition(int[] s, int[] sn, int[] index) { for (int idx = index[0] == -1 ? fNumElements : index[0] + 1; idx < fNumTotal; idx++) { if (isAllowedTransition(s, sn, idx)) { index[0] = idx; return fWildcards[idx]; } } index[0] = -1; return null; } private boolean isAllowedTransition(int[] s, int[] sn, int index) {
private void getDerivedSiblings() { siblingsD = derived.getDefinedNames(sgh); }
public XSElementDecl nextElementTransition(int[] s, int[] sn, int[] index) { for (int idx = index[0] == -1 ? 1 : index[0] + 1; idx < fNumElements; idx++) { if (isAllowedTransition(s, sn, idx)) { index[0] = idx; return fElements[idx]; } } index[0] = -1; return null; } public XSWildcardDecl nextWildcardTransition(int[] s, int[] sn, int[] index) {
XSCMValidator createAll11CM(XSParticleDecl particle, XSOpenContentDecl openContent) { if (particle.fMaxOccurs == 0) return null; // get the model group, and add all children of it to the content model XSModelGroupImpl group = (XSModelGroupImpl)particle.fValue; // create an all content model. the parameter indicates whether // the <all> itself is optional XS11AllCM allContent = new XS11AllCM(particle.fMinOccurs == 0, group.fParticleCount, group.fParticles, openContent); return allContent; }
/** * The method indicates the end of list of children * * @param currentState Current state of the content model * @return true if the last state was a valid final state */ public boolean endContentModel (int[] currentState) { int state = currentState[0]; if (state == XSCMValidator.FIRST_ERROR || state == XSCMValidator.SUBSEQUENT_ERROR) { return false; } return isFinal(currentState); }
void testOccurrences(int occurs) { fNodeFactory.testOccurrences(occurs); } }
public XSElementDecl nextElementTransition(int[] s, int[] sn, int[] index) { for (int idx = index[0] + 1; idx < fNumElements; idx++) { if (isAllowedTransition(s, sn, idx)) { index[0] = idx; return fElements[idx]; } } index[0] = -1; return null; } public XSWildcardDecl nextWildcardTransition(int[] s, int[] sn, int[] index) {
private void getBaseSiblings() { siblingsB = base.getDefinedNames(sgh); }