xmltorng.i2s.impl
Class RepeatableElementPatternCategory

java.lang.Object
  extended by xmltorng.i2s.impl.RepeatableElementPatternCategory
All Implemented Interfaces:
ChoicePatternCategory, PatternCategory
Direct Known Subclasses:
OptionalRepeatableElementPatternCategory

public class RepeatableElementPatternCategory
extends java.lang.Object
implements ChoicePatternCategory

The RepeatableElementPatterncategory is a pattern category that contains choice patterns between repeatable or not repeatable named elements. May also contain attributes and/or text. Formally: attribute ::= attributes ::= attribute | ( attribute+ ) element ::= any oneOrMoreElement ::= element | ( element ) | ( (element* & ( element )+) ) oneOrMoreElementAndText ::= oneOrMoreElement | ( oneOrMoreElement ) content ::= oneOrMoreElementAndText | ( attributes oneOrMoreElementAndText )


Field Summary
protected  AttributesPatternCategory attributesPatternCategory
           
protected  java.util.Map fromElementNameToRepeatable
           
protected  boolean hasText
           
 
Constructor Summary
protected RepeatableElementPatternCategory()
           
protected RepeatableElementPatternCategory(AttributesPatternCategory attributesPatternCategory, boolean hasText)
           
protected RepeatableElementPatternCategory(Name elementName, boolean isRepeatable)
           
 
Method Summary
 void addElementName(Name elementName, boolean isRepeatable)
           
 boolean addPattern(Name[] attributeNames, boolean hasText, RepeatableName[] repeatableElementNames)
          Add a pattern to this pattern category.
 AttributesPatternCategory attributesPatternCategory()
           
 java.util.Map fromElementNameToRepeatable()
          Return a not empty map with Name as input and Boolean as output.
 Pattern fullPattern(java.util.Map fromNameToElementDefinition)
          Return a pattern that meets all the entered patterns.
 boolean hasText()
           
 boolean isPatternOptional()
          The returned value say if the element may be ommited or not.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

attributesPatternCategory

protected AttributesPatternCategory attributesPatternCategory

hasText

protected boolean hasText

fromElementNameToRepeatable

protected final java.util.Map fromElementNameToRepeatable
Constructor Detail

RepeatableElementPatternCategory

protected RepeatableElementPatternCategory()

RepeatableElementPatternCategory

protected RepeatableElementPatternCategory(AttributesPatternCategory attributesPatternCategory,
                                           boolean hasText)

RepeatableElementPatternCategory

protected RepeatableElementPatternCategory(Name elementName,
                                           boolean isRepeatable)
Method Detail

addElementName

public void addElementName(Name elementName,
                           boolean isRepeatable)

attributesPatternCategory

public AttributesPatternCategory attributesPatternCategory()

hasText

public boolean hasText()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

fullPattern

public Pattern fullPattern(java.util.Map fromNameToElementDefinition)
Description copied from interface: PatternCategory
Return a pattern that meets all the entered patterns. May fail, then return null. If successfull then may use and update the given map between element name and element definition.

Specified by:
fullPattern in interface PatternCategory

addPattern

public boolean addPattern(Name[] attributeNames,
                          boolean hasText,
                          RepeatableName[] repeatableElementNames)
Description copied from interface: PatternCategory
Add a pattern to this pattern category. The pattern is given as a text presence flag, an attribute name set and an element name sequence, where each element may or may not be repeated. Returns true in case of success or if the pattern category already includes the pattern. Returns false if the pattern is out of the pattern category but the pattern category might be affected in that case too.

Specified by:
addPattern in interface PatternCategory

fromElementNameToRepeatable

public java.util.Map fromElementNameToRepeatable()
Description copied from interface: ChoicePatternCategory
Return a not empty map with Name as input and Boolean as output. The boolean value say if the named element may be repeated or not.

Specified by:
fromElementNameToRepeatable in interface ChoicePatternCategory

isPatternOptional

public boolean isPatternOptional()
Description copied from interface: ChoicePatternCategory
The returned value say if the element may be ommited or not.

Specified by:
isPatternOptional in interface ChoicePatternCategory