Class ChoiceGuard

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

public class ChoiceGuard extends CompositorGuard
CompositorGuard for the Choice compositor.
Author:
ostwald
  • Constructor Details

    • ChoiceGuard

      public ChoiceGuard(Compositor compositor, org.dom4j.Element instanceElement)
      Constructor for the ChoiceGuard object
      Parameters:
      compositor - NOT YET DOCUMENTED
      instanceElement - NOT YET DOCUMENTED
    • ChoiceGuard

      public ChoiceGuard(Compositor compositor, List instanceList)
  • Method Details

    • 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