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

Class ContentModel_mixin

source code

object --+    
         |    
   cscRoot --+
             |
            ContentModel_mixin
Known Subclasses:

Declares methods used by classes representing content model components.

Instance Methods [hide private]
 
newState(self, parent_particle_state)
Return a ContentState_mixin instance that will validate the state of this model component.
source code
 
_validateCloneSymbolSet(self, symbol_set_im)
Create a mutable copy of the symbol set.
source code
 
_validateCloneOutputSequence(self, output_sequence_im)
Create a mutable copy of the output sequence.
source code
 
_validateReplaceResults(self, symbol_set_out, symbol_set_new, output_sequence_out, output_sequence_new)
In-place update of symbol set and output sequence structures.
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 cscRoot: __init__

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

newState(self, parent_particle_state)

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.

_validateCloneSymbolSet(self, symbol_set_im)

source code 

Create a mutable copy of the symbol set.

The top-level map is copied, as are the lists of values to which the symbols map. The values within the lists are unchanged, as validation does not affect them.

_validateReplaceResults(self, symbol_set_out, symbol_set_new, output_sequence_out, output_sequence_new)

source code 

In-place update of symbol set and output sequence structures.

Use this to copy from temporary mutable structures updated by local validation into the structures that were passed in once the validation has succeeded.

_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.