public final XSModelGroupImpl getModelGroup(){ int chunk = fModelGroupIndex >> CHUNK_SHIFT; int index = fModelGroupIndex & CHUNK_MASK; ensureModelGroupCapacity(chunk); if (fModelGroup[chunk][index] == null) { fModelGroup[chunk][index] = new XSModelGroupImpl(); } else { fModelGroup[chunk][index].reset(); } fModelGroupIndex++; return fModelGroup[chunk][index]; }
public boolean isEmpty() { if (fType == PARTICLE_EMPTY) return true; if (fType == PARTICLE_ELEMENT || fType == PARTICLE_WILDCARD) return false; return ((XSModelGroupImpl)fValue).isEmpty(); }
public int maxEffectiveTotalRange() { if (fType == XSParticleDecl.PARTICLE_EMPTY) { return 0; } if (fType == PARTICLE_MODELGROUP) { int max = ((XSModelGroupImpl)fValue).maxEffectiveTotalRange(); if (max == SchemaSymbols.OCCURRENCE_UNBOUNDED) return SchemaSymbols.OCCURRENCE_UNBOUNDED; if (max != 0 && fMaxOccurs == SchemaSymbols.OCCURRENCE_UNBOUNDED) return SchemaSymbols.OCCURRENCE_UNBOUNDED; return max * fMaxOccurs; } return fMaxOccurs; }
public int maxEffectiveTotalRange() { if (fCompositor == MODELGROUP_CHOICE) return maxEffectiveTotalRangeChoice(); else return maxEffectiveTotalRangeAllSeq(); }
/** * 3.8.6 Effective Total Range (all and sequence) and * Effective Total Range (choice) * The following methods are used to return min/max range for a particle. * They are not exactly the same as it's described in the spec, but all the * values from the spec are retrievable by these methods. */ public int minEffectiveTotalRange() { if (fCompositor == MODELGROUP_CHOICE) return minEffectiveTotalRangeChoice(); else return minEffectiveTotalRangeAllSeq(); }
public static XSParticleDecl getEmptySequence() { if (fEmptyParticle == null) { XSModelGroupImpl group = new XSModelGroupImpl(); group.fCompositor = XSModelGroupImpl.MODELGROUP_SEQUENCE; group.fParticleCount = 0; group.fParticles = null; group.fAnnotations = XSObjectListImpl.EMPTY_LIST; XSParticleDecl particle = new XSParticleDecl(); particle.fType = XSParticleDecl.PARTICLE_MODELGROUP; particle.fValue = group; particle.fAnnotations = XSObjectListImpl.EMPTY_LIST; fEmptyParticle = particle; } return fEmptyParticle; }
/** * 3.8.6 Effective Total Range (all and sequence) and * Effective Total Range (choice) * The following methods are used to return min/max range for a particle. * They are not exactly the same as it's described in the spec, but all the * values from the spec are retrievable by these methods. */ public int minEffectiveTotalRange() { if (fType == XSParticleDecl.PARTICLE_EMPTY) { return 0; } if (fType == PARTICLE_MODELGROUP) { return ((XSModelGroupImpl)fValue).minEffectiveTotalRange() * fMinOccurs; } return fMinOccurs; }
private void expandGroupParticleForCompositorAll(XSParticleDecl particle, Element contextElement) { XSModelGroupImpl group = (XSModelGroupImpl) particle.fValue; if (group.getCompositor() == XSModelGroup.COMPOSITOR_ALL) { XSParticleDecl[] subParticles = group.fParticles; for (int partlIdx = 0; partlIdx < group.fParticleCount; partlIdx++) { short particleType = subParticles[partlIdx].fType; if (particleType == XSParticleDecl.PARTICLE_ELEMENT || particleType == XSParticleDecl.PARTICLE_WILDCARD) { fPArray.addParticle(subParticles[partlIdx]); } else { // the sub particle is a model-group. call the method recursively. expandGroupParticleForCompositorAll(subParticles[partlIdx], contextElement); } } } else { String wrongCompsName = (group.getCompositor() == XSModelGroup.COMPOSITOR_SEQUENCE) ? "xs:"+SchemaSymbols.ELT_SEQUENCE : "xs:"+SchemaSymbols.ELT_CHOICE; // it's an error to have a non-all (xs:all) compositor within "xs:all -> xs:group" reportSchemaError("cos-all-limited.2-xs11", new Object[] { wrongCompsName }, contextElement); } } // expandGroupParticleForCompositorAll
/** * * @param result * @param group * @throws OdaException */ private void populateModelGroup( List result, XSModelGroupImpl group ) throws OdaException { for ( int i = 0; i < group.getParticles( ).getLength( ); i++ ) { ATreeNode node = null; Object o = ( (XSParticleDecl) group.getParticles( ).item( i ) ).getTerm( ); if ( o instanceof XSModelGroupImpl ) { populateModelGroup( result, (XSModelGroupImpl) o ); } else if ( o instanceof XSElementDecl ) { node = new ATreeNode( (XSElementDecl) o ); addNodeToChild( result, node ); } } }
private XSParticleDecl createUnboundedAnyWildcardSequenceParticle() { XSParticleDecl particle = createUnboundedModelGroupParticle(); XSModelGroupImpl sequence = new XSModelGroupImpl(); sequence.fCompositor = XSModelGroupImpl.MODELGROUP_SEQUENCE; sequence.fParticleCount = 1; sequence.fParticles = new XSParticleDecl[1]; sequence.fParticles[0] = createAnyLaxWildcardParticle(); particle.fValue = sequence; return particle; }
private static XSParticleDecl getErrorContent() { if (fErrorContent == null) { XSParticleDecl particle = new XSParticleDecl(); particle.fType = XSParticleDecl.PARTICLE_WILDCARD; particle.fValue = getErrorWildcard(); particle.fMinOccurs = 0; particle.fMaxOccurs = SchemaSymbols.OCCURRENCE_UNBOUNDED; XSModelGroupImpl group = new XSModelGroupImpl(); group.fCompositor = XSModelGroupImpl.MODELGROUP_SEQUENCE; group.fParticleCount = 1; group.fParticles = new XSParticleDecl[1]; group.fParticles[0] = particle; XSParticleDecl errorContent = new XSParticleDecl(); errorContent.fType = XSParticleDecl.PARTICLE_MODELGROUP; errorContent.fValue = group; fErrorContent = errorContent; } return fErrorContent; } private static XSWildcardDecl getErrorWildcard() {
private XSParticleDecl createParticle() { // the wildcard used in anyType (content and attribute) // the spec will change strict to skip for anyType XSWildcardDecl wildcard = new XSWildcardDecl(); wildcard.fProcessContents = XSWildcardDecl.PC_LAX; // the particle for the content wildcard XSParticleDecl particleW = new XSParticleDecl(); particleW.fMinOccurs = 0; particleW.fMaxOccurs = SchemaSymbols.OCCURRENCE_UNBOUNDED; particleW.fType = XSParticleDecl.PARTICLE_WILDCARD; particleW.fValue = wildcard; // the model group of a sequence of the above particle XSModelGroupImpl group = new XSModelGroupImpl(); group.fCompositor = XSModelGroupImpl.MODELGROUP_SEQUENCE; group.fParticleCount = 1; group.fParticles = new XSParticleDecl[1]; group.fParticles[0] = particleW; // the content of anyType: particle of the above model group XSParticleDecl particleG = new XSParticleDecl(); particleG.fType = XSParticleDecl.PARTICLE_MODELGROUP; particleG.fValue = group; return particleG; } }
Long defaultVals = (Long)attrValues[XSAttributeChecker.ATTIDX_FROMDEFAULT]; XSModelGroupImpl group = new XSModelGroupImpl(); group.fCompositor = choice ? XSModelGroupImpl.MODELGROUP_CHOICE : XSModelGroupImpl.MODELGROUP_SEQUENCE; group.fParticleCount = fPArray.getParticleCount();
Long defaultVals = (Long)attrValues[XSAttributeChecker.ATTIDX_FROMDEFAULT]; XSModelGroupImpl group = new XSModelGroupImpl(); group.fCompositor = XSModelGroupImpl.MODELGROUP_ALL; group.fParticleCount = fPArray.getParticleCount();
XSModelGroupImpl group = new XSModelGroupImpl(); group.fCompositor = XSModelGroupImpl.MODELGROUP_ALL; group.fParticleCount = ((XSModelGroupImpl)baseContent.fValue).fParticleCount + ((XSModelGroupImpl)fParticle.fValue).fParticleCount; XSModelGroupImpl group = new XSModelGroupImpl(); group.fCompositor = XSModelGroupImpl.MODELGROUP_SEQUENCE; group.fParticleCount = 2;
XSModelGroupImpl annotationChoice = new XSModelGroupImpl(); annotationChoice.fCompositor = XSModelGroupImpl.MODELGROUP_CHOICE; annotationChoice.fParticleCount = 2;