private XSParticleDecl createUnboundedModelGroupParticle() { XSParticleDecl particle = new XSParticleDecl(); particle.fMinOccurs = 0; particle.fMaxOccurs = SchemaSymbols.OCCURRENCE_UNBOUNDED; particle.fType = XSParticleDecl.PARTICLE_MODELGROUP; return particle; }
public String toString() { if (fDescription == null) { StringBuffer buffer = new StringBuffer(); appendParticle(buffer); if (!(fMinOccurs == 0 && fMaxOccurs == 0 || fMinOccurs == 1 && fMaxOccurs == 1)) { buffer.append('{').append(fMinOccurs); if (fMaxOccurs == SchemaSymbols.OCCURRENCE_UNBOUNDED) buffer.append("-UNBOUNDED"); else if (fMinOccurs != fMaxOccurs) buffer.append('-').append(fMaxOccurs); buffer.append('}'); } fDescription = buffer.toString(); } return fDescription; }
public boolean isEmpty() { for (int i = 0; i < fParticleCount; i++) { if (!fParticles[i].isEmpty()) return false; } return true; }
public final XSParticleDecl getParticleDecl(){ int chunk = fParticleDeclIndex >> CHUNK_SHIFT; int index = fParticleDeclIndex & CHUNK_MASK; ensureParticleDeclCapacity(chunk); if (fParticleDecl[chunk][index] == null) { fParticleDecl[chunk][index] = new XSParticleDecl(); } else { fParticleDecl[chunk][index].reset(); } fParticleDeclIndex++; return fParticleDecl[chunk][index]; }
if (dParticle.isEmpty() && !bParticle.emptiable()) { throw new XMLSchemaException("cos-particle-restrict.a", null); else if (!dParticle.isEmpty() && bParticle.isEmpty()) { throw new XMLSchemaException("cos-particle-restrict.b", null); dMinEffectiveTotalRange = dParticle.minEffectiveTotalRange(); if (dMaxEffectiveTotalRange == OCCURRENCE_UNKNOWN) dMaxEffectiveTotalRange = dParticle.maxEffectiveTotalRange(); dMinEffectiveTotalRange = dParticle.minEffectiveTotalRange(); if (dMaxEffectiveTotalRange == OCCURRENCE_UNKNOWN) dMaxEffectiveTotalRange = dParticle.maxEffectiveTotalRange(); dMinEffectiveTotalRange = dParticle.minEffectiveTotalRange(); if (dMaxEffectiveTotalRange == OCCURRENCE_UNKNOWN) dMaxEffectiveTotalRange = dParticle.maxEffectiveTotalRange();
XSParticleDecl fakeDerived = new XSParticleDecl(); XSParticleDecl fakeBase = new XSParticleDecl(); fakeDerived.fType = XSParticleDecl.PARTICLE_MODELGROUP; fakeBase.fType = XSParticleDecl.PARTICLE_MODELGROUP; if (!fakeBase.emptiable()) { reportSchemaError(errorReporter, rgLocators[i/2-1], "src-redefine.6.2.2", if (baseParticle!=null && !baseParticle.emptiable()) { reportSchemaError(errorReporter,ctLocators[j], "derivation-ok-restriction.5.3.2",
/** * 3.9.6 Schema Component Constraint: Particle Emptiable * whether this particle is emptible */ public boolean emptiable() { return minEffectiveTotalRange() == 0; }
private int maxEffectiveTotalRangeAllSeq() { int total = 0, one; for (int i = 0; i < fParticleCount; i++) { one = fParticles[i].maxEffectiveTotalRange(); if (one == SchemaSymbols.OCCURRENCE_UNBOUNDED) return SchemaSymbols.OCCURRENCE_UNBOUNDED; total += one; } return total; }
public String toString() { // REVISIT: Commented code may help to eliminate redundant parentheses (test first before committing) if (fDescription == null) { StringBuffer buffer = new StringBuffer(); if (fCompositor == MODELGROUP_ALL) buffer.append("all("); else //if (fMinOccurs != 1 || fMaxOccurs != 1) buffer.append('('); if (fParticleCount > 0) buffer.append(fParticles[0].toString()); for (int i = 1; i < fParticleCount; i++) { if (fCompositor == MODELGROUP_CHOICE) buffer.append('|'); else buffer.append(','); buffer.append(fParticles[i].toString()); } //if (fCompositor == MODELGROUP_ALL || fMinOccurs != 1 || fMaxOccurs != 1) buffer.append(')'); fDescription = buffer.toString(); } return fDescription; }
if (maxOccurs > minOccurs || particle.getMaxOccursUnbounded()) { minOccurs = 1; compactedForUPA = true;
/** * * @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 ); } } }
if (!foundIt[j] && !particle2.emptiable()) { throw new XMLSchemaException("rcase-RecurseUnordered.2", null);
private int minEffectiveTotalRangeAllSeq() { int total = 0; for (int i = 0; i < fParticleCount; i++) total += fParticles[i].minEffectiveTotalRange(); return total; }
private int maxEffectiveTotalRangeChoice() { int max = 0, one; if (fParticleCount > 0) { max = fParticles[0].maxEffectiveTotalRange(); if (max == SchemaSymbols.OCCURRENCE_UNBOUNDED) return SchemaSymbols.OCCURRENCE_UNBOUNDED; } for (int i = 1; i < fParticleCount; i++) { one = fParticles[i].maxEffectiveTotalRange(); if (one == SchemaSymbols.OCCURRENCE_UNBOUNDED) return SchemaSymbols.OCCURRENCE_UNBOUNDED; if (one > max) max = one; } return max; }
void appendTypeInfo(StringBuffer str) { String contentType[] = {"EMPTY", "SIMPLE", "ELEMENT", "MIXED"}; String derivedBy[] = {"EMPTY", "EXTENSION", "RESTRICTION"}; str.append("Complex type name='").append(fTargetNamespace).append(',').append(getTypeName()).append("', "); if (fBaseType != null) { str.append(" base type name='").append(fBaseType.getName()).append("', "); } str.append(" content type='").append(contentType[fContentType]).append("', "); str.append(" isAbstract='").append(getAbstract()).append("', "); str.append(" hasTypeId='").append(containsTypeID()).append("', "); str.append(" final='").append(fFinal).append("', "); str.append(" block='").append(fBlock).append("', "); if (fParticle != null) { str.append(" particle='").append(fParticle.toString()).append("', "); } str.append(" derivedBy='").append(derivedBy[fDerivedBy]).append("'. "); }
private XSParticleDecl createChoiceElementParticle(XSElementDecl ref) { XSParticleDecl particle = new XSParticleDecl(); particle.fMinOccurs = 1; particle.fMaxOccurs = 1; particle.fType = XSParticleDecl.PARTICLE_ELEMENT; particle.fValue = ref; return particle; }
if (!((XSParticleDecl)ctype.getParticle()).emptiable()) return null;
private int minEffectiveTotalRangeChoice() { int min = 0, one; if (fParticleCount > 0) min = fParticles[0].minEffectiveTotalRange(); for (int i = 1; i < fParticleCount; i++) { one = fParticles[i].minEffectiveTotalRange(); if (one < min) min = one; } return min; }
private static void gatherChildren(int parentType, XSParticleDecl p, Vector children) { int min = p.fMinOccurs; int max = p.fMaxOccurs; int type = p.fType; if (type == XSParticleDecl.PARTICLE_MODELGROUP) type = ((XSModelGroupImpl)p.fValue).fCompositor; if (type == XSParticleDecl.PARTICLE_ELEMENT || type== XSParticleDecl.PARTICLE_WILDCARD) { children.addElement(p); return; } if (! (min==1 && max==1)) { children.addElement(p); } else if (parentType == type) { XSModelGroupImpl group = (XSModelGroupImpl)p.fValue; for (int i = 0; i < group.fParticleCount; i++) gatherChildren(type, group.fParticles[i], children); } else if (!p.isEmpty()) { children.addElement(p); } }