DLESE Tools
v1.6.0

org.dlese.dpc.xml.schema.compositor
Class ChoiceGuard

java.lang.Object
  extended by org.dlese.dpc.xml.schema.compositor.CompositorGuard
      extended by org.dlese.dpc.xml.schema.compositor.ChoiceGuard

public class ChoiceGuard
extends CompositorGuard

CompositorGuard for the Choice compositor.

Author:
ostwald

Field Summary
 
Fields inherited from class org.dlese.dpc.xml.schema.compositor.CompositorGuard
instanceMembers
 
Constructor Summary
ChoiceGuard(Compositor compositor, Element instanceElement)
          Constructor for the ChoiceGuard object
ChoiceGuard(Compositor compositor, List instanceList)
           
 
Method Summary
 boolean acceptsNewMember()
          Returns true if a new member may be added.
 boolean checkValid()
          NOTE: if any of the choice compositor members has a minOccurs of 0, then there need not be any occurrances!
 List getAcceptableMembers()
          Returns a list of element names representing the choices that can be legally made.
protected  List getOccurrences()
          Returns a list of occurrence instances that can be used to determine whether an instance document element satisfies the occurrence constraints of the schema.
protected static void prtln(String s)
          NOT YET DOCUMENTED
 
Methods inherited from class org.dlese.dpc.xml.schema.compositor.CompositorGuard
acceptsNewMember, findOccurence, findOccurrence, getCompositor, getInstance, getOccurrencesCount, getOccurrencesCount, getSubOccurrenceCount, printInstanceMembers, printOccurrences, resolveLeafNameToCM, resolveLeafNameToCMName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ChoiceGuard

public ChoiceGuard(Compositor compositor,
                   Element instanceElement)
Constructor for the ChoiceGuard object

Parameters:
compositor - NOT YET DOCUMENTED
instanceElement - NOT YET DOCUMENTED

ChoiceGuard

public ChoiceGuard(Compositor compositor,
                   List instanceList)
Method Detail

getAcceptableMembers

public List getAcceptableMembers()
Returns a list of element names representing the choices that can be legally made.

Returns:
The acceptableMembers value

getOccurrences

protected List getOccurrences()
                       throws Exception
Returns a list of occurrence instances that can be used to determine whether an instance document element satisfies the occurrence constraints of the schema.

Walk down the buckets, when there is no room to add the current member, start an new occurrance. NOTE: the order in which we add members is aribitrary - we just can't overfill any single member.

NOTE: this does not account for many of the children choice compositors can have: - choice - sequence - any - element - group

Specified by:
getOccurrences in class CompositorGuard
Returns:
The occurrences value
Throws:
Exception - NOT YET DOCUMENTED

checkValid

public boolean checkValid()
                   throws Exception
NOTE: if any of the choice compositor members has a minOccurs of 0, then there need not be any occurrances!

Overrides:
checkValid in class CompositorGuard
Returns:
NOT YET DOCUMENTED
Throws:
Exception - NOT YET DOCUMENTED

acceptsNewMember

public boolean acceptsNewMember()
Returns true if a new member may be added.

Takes into account whether there is a legal choice to be made, as well as the maxOccurs constraint of the compositor.

Overrides:
acceptsNewMember in class CompositorGuard
Returns:
NOT YET DOCUMENTED

prtln

protected static void prtln(String s)
NOT YET DOCUMENTED

Parameters:
s - NOT YET DOCUMENTED

DLESE Tools
v1.6.0