com.saxonica.schema
Class AbstractParticle

java.lang.Object
  extended by com.saxonica.schema.SchemaStructure
      extended by com.saxonica.schema.AbstractParticle
All Implemented Interfaces:
Particle, SerializableSchemaComponent, UserSchemaComponent, Serializable, SourceLocator, SchemaComponent
Direct Known Subclasses:
Compositor, GroupReference

public abstract class AbstractParticle
extends SchemaStructure
implements Particle

An abstract class that implements an XML Schema Particle.

Note that not all Particles belong to this class. In particular, Element Wildcards are particles, but they are not instances of AbstractParticle: this is because it is more convenient for them to share implementation details with Attribute Wildcards. To refer generically to Particles, use the Particle interface.

See Also:
Serialized Form

Field Summary
static int UNBOUNDED
          A constant to represent an UNBOUNDED number of occurrences
 
Fields inherited from interface net.sf.saxon.type.SchemaComponent
FIXED_UP, INCOMPLETE, INVALID, UNVALIDATED, VALIDATED, VALIDATING
 
Fields inherited from interface com.saxonica.schema.SerializableSchemaComponent
ALL_COMPOSITOR, ATOMIC_TYPE, ATTRIBUTE_DECL, ATTRIBUTE_GROUP, ATTRIBUTE_GROUP_REF, ATTRIBUTE_USE, ATTRIBUTE_WILDCARD, CHOICE_COMPOSITOR, COMPLEX_TYPE, ELEMENT_DECL, ELEMENT_PARTICLE, ELEMENT_WILDCARD, FACET, KEY, KEYREF, LIST_TYPE, MODEL_GROUP, MODEL_GROUP_REF, NOTATION, SEQUENCE_COMPOSITOR, UNION_TYPE, UNIQUE
 
Method Summary
static int computeParticleCardinality(int minOccurs, int maxOccurs)
          Compute an XPath cardinality (e.g.
 int getMaxOccurs()
          Returns the maximum number of occurrences that this Particle may appear in the containing content model
 int getMinOccurs()
          Returns the minimum number of occurrences that this Particle must appear in the containing content model
abstract  Term getTerm()
          Get the term corresponding to this particle
 boolean isPointless(Particle container)
          Test whether the particle is pointless, as described in XML Schema Part 1 Schema Component Constraint: Particle Valid (Restriction)
 void setMaxOccurs(int maxOccurs)
          Sets the maximum number of occurrences for this Particle within the containing content model
 void setMinOccurs(int minOccurs)
          Sets the minimum number of occurrences for this Particle within the containing content model
 
Methods inherited from class com.saxonica.schema.SchemaStructure
getColumnNumber, getConfiguration, getFixupStatus, getLineNumber, getPublicId, getSystemId, getValidationStatus, lookForCycles, setConfiguration, setFixupStatus, setLineNumber, setLocator, setSystemId, setValidationStatus
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.saxonica.schema.Particle
compile, gatherAllPermittedElements, getElementParticleCardinality, getElementParticleType, isEmptiable
 
Methods inherited from interface com.saxonica.schema.UserSchemaComponent
fixup, lookForCycles, validate
 
Methods inherited from interface net.sf.saxon.type.SchemaComponent
getValidationStatus
 
Methods inherited from interface com.saxonica.schema.SerializableSchemaComponent
getComponentTypeCode, serialize
 

Field Detail

UNBOUNDED

public static int UNBOUNDED
A constant to represent an UNBOUNDED number of occurrences

Method Detail

getMaxOccurs

public final int getMaxOccurs()
Returns the maximum number of occurrences that this Particle may appear in the containing content model

Specified by:
getMaxOccurs in interface Particle
Returns:
the maximum number of occurrences that this Particle may appear. A negative (n < 0) value indicates that the value is unspecified (ie. unbounded).

getMinOccurs

public final int getMinOccurs()
Returns the minimum number of occurrences that this Particle must appear in the containing content model

Specified by:
getMinOccurs in interface Particle
Returns:
the minimum number of occurrences that this Particle must appear A negative (n < 0) value indicates that the value is unspecified.

setMaxOccurs

public final void setMaxOccurs(int maxOccurs)
Sets the maximum number of occurrences for this Particle within the containing content model

Parameters:
maxOccurs - the maximum number of occurrences for this Particle, or -1 to indicate that the maximum is unbounded

setMinOccurs

public final void setMinOccurs(int minOccurs)
Sets the minimum number of occurrences for this Particle within the containing content model

Specified by:
setMinOccurs in interface Particle
Parameters:
minOccurs - the minimum number of occurrences for this Particle

getTerm

public abstract Term getTerm()
Get the term corresponding to this particle

Specified by:
getTerm in interface Particle
Returns:
the corresponding term

isPointless

public boolean isPointless(Particle container)
Test whether the particle is pointless, as described in XML Schema Part 1 Schema Component Constraint: Particle Valid (Restriction)

Specified by:
isPointless in interface Particle

computeParticleCardinality

public static int computeParticleCardinality(int minOccurs,
                                             int maxOccurs)
Compute an XPath cardinality (e.g. ONE_OR_MORE) from an XML Schema cardinality

Parameters:
minOccurs - Minimum occurrences
maxOccurs - Maximum occurrences (-1 = unbounded)
Returns:
The XPath cardinality


Copyright (C) Michael H. Kay. All rights reserved.