Package pyxb :: Package binding :: Module content :: Class ParticleModel
[hide private]
[frames] | no frames]

Class ParticleModel

source code

    object --+        
             |        
       cscRoot --+    
                 |    
ContentModel_mixin --+
                     |
                    ParticleModel

Content model dealing with particles: terms with occurrence restrictions

Instance Methods [hide private]
 
minOccurs(self)
The minimum number of times the term must occur.
source code
 
maxOccurs(self)
The maximum number of times the term may occur.
source code
 
term(self)
The term for a single occurrence.
source code
 
meetsMaximum(self, count)
Returns: True iff there is no maximum on term occurrence, or the provided count does not exceed that maximum
source code
 
meetsMinimum(self, count)
Returns: True iff the provided count meets the minimum number of occurrences
source code
 
satisfiesOccurrences(self, count)
Returns: True iff the provided count satisfies the occurrence requirements
source code
 
__init__(self, term, min_occurs=1, max_occurs=1)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
newState(self)
Return a ContentState_mixin instance that will validate the state of this model component.
source code
 
validate(self, symbol_set)
Determine whether the particle requirements are satisfiable by the given symbol set.
source code
 
_validate(self, symbol_set, output_sequence)
Determine whether an output sequence created from the symbols can be made consistent with the model.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  __minOccurs = None
hash(x)
  __maxOccurs = None
hash(x)
  __term = None
The ContentModel_mixin for a single occurrence.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

minOccurs(self)

source code 

The minimum number of times the term must occur.

This will be a non-negative integer.

maxOccurs(self)

source code 

The maximum number of times the term may occur.

This will be a positive integer, or None indicating an unbounded number of occurrences.

meetsMaximum(self, count)

source code 
Returns:
True iff there is no maximum on term occurrence, or the provided count does not exceed that maximum

meetsMinimum(self, count)

source code 
Returns:
True iff the provided count meets the minimum number of occurrences

satisfiesOccurrences(self, count)

source code 
Returns:
True iff the provided count satisfies the occurrence requirements

__init__(self, term, min_occurs=1, max_occurs=1)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

newState(self)

source code 

Return a ContentState_mixin instance that will validate the state of this model component.

Parameters:
  • parent_particle_state - The ParticleState instance for which this instance is a term. None for the top content model of a complex data type.
Overrides: ContentModel_mixin.newState
(inherited documentation)

validate(self, symbol_set)

source code 

Determine whether the particle requirements are satisfiable by the given symbol set.

The symbol set represents letters in an alphabet. If those letters can be combined in a way that satisfies the regular expression expressed in the model, a satisfying sequence is returned and the symbol set is reduced by the letters used to form the sequence. If the content model cannot be satisfied, None is returned and the symbol set remains unchanged.

Parameters:
  • symbol_set - A map from ElementUse instances to a list of values. The order of the values corresponds to the order in which they should appear. A key of None identifies values that are stored as wildcard elements. Values are removed from the lists as they are used; when the last value of a list is removed, its key is removed from the map. Thus an empty dictionary is the indicator that no more symbols are available.
Returns:
returns None, or a list of tuples ( eu, val ) where eu is an ElementUse from the set of symbol keys, and val is a value from the corresponding list.

_validate(self, symbol_set, output_sequence)

source code 

Determine whether an output sequence created from the symbols can be made consistent with the model.

The symbol set represents letters in an alphabet; the output sequence orders those letters in a way that satisfies the regular expression expressed in the model. Both are changed as a result of a successful validation; both remain unchanged if the validation failed. In recursing, implementers may assume that output_sequence is monotonic: its length remains unchanged after an invocation iff the symbol set also remains unchanged. The _validateCloneSymbolSet, _validateCloneOutputSequence, and _validateReplaceResults methods are available to help preserve this behavior.

Parameters:
  • symbol_set - A map from ElementUse instances to a list of values. The order of the values corresponds to the order in which they should appear. A key of None identifies values that are stored as wildcard elements. Values are removed from the lists as they are used; when the last value of a list is removed, its key is removed from the map. Thus an empty dictionary is the indicator that no more symbols are available.
  • output_sequence - A mutable list to which should be appended tuples ( eu, val ) where eu is an ElementUse from the set of symbol keys, and val is a value from the corresponding list. A document generated by producing the elements in the given order is expected to validate.
Returns:
True iff the model validates. symbol_set and output_path will be unchanged if this returns False.
Overrides: ContentModel_mixin._validate
(inherited documentation)