Class ContentParticle


  • public class ContentParticle
    extends java.lang.Object
    Implementation of DTD Content Particle specification, used to define the content of an element.
    Version:
    $Revision: 5951 $ $Date: 2003-03-03 00:05:44 -0700 (Mon, 03 Mar 2003) $
    Author:
    Alexander Totok
    • Constructor Summary

      Constructors 
      Constructor Description
      ContentParticle()
      Constructor, setting occurance specification to ONE, by default.
      ContentParticle​(java.lang.String reference)
      Creates content particle and sets its type to REFERENCE, that is the content is exactly one child-element.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addChild​(ContentParticle cp)
      Adds child to the vector of child elements (content particles).
      java.util.Enumeration getChildren()
      Returns enumeration of the children - content particles, that form the content of this Content Particle, if has SEQ or CHOICE type (sequence or choice list), null otherwise.
      java.lang.String getReference()
      Returns the name of the child element, if content is exactly one child.
      boolean isChoiceType()
      True if the content is a choice list of content particles, false otherwise.
      boolean isOneOccurance()
      True if ocurence specification of the content particle is ONE, false otherwise.
      boolean isOneOrMoreOccurances()
      True if occurance specification of the content particle is ONE_OR_MORE, false otherwise.
      boolean isReferenceType()
      True if the content is exactly on child-element, false otherwise.
      boolean isSeqType()
      True if the content is a sequence list of content particles, false otherwise.
      boolean isZeroOrMoreOccurances()
      True if occurance specification of the content particle is ZERO_OR_MORE, false otherwise.
      boolean isZeroOrOneOccurance()
      True if occurance specification of the content particle is ZERO_OR_ONE, false otherwise.
      void setChoiceType()
      Sets the content to choice list of content particles.
      void setOneOccurance()
      Sets occurance specification of the content particle to ONE.
      void setOneOrMoreOccurances()
      Sets occurance specification of the content particle to ONE_OR_MORE.
      void setReferenceType​(java.lang.String reference)
      Makes the content particle represent the content with exactly one child-element.
      void setSeqType()
      Sets the content to sequence list of content particles.
      void setZeroOrMoreOccurances()
      Sets occurance specification of the content particle to ZERO_OR_MORE.
      void setZeroOrOneOccurance()
      Sets occurance specification of the content particle to ZERO_OR_ONE.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ContentParticle

        public ContentParticle()
        Constructor, setting occurance specification to ONE, by default.
      • ContentParticle

        public ContentParticle​(java.lang.String reference)
        Creates content particle and sets its type to REFERENCE, that is the content is exactly one child-element.
        Parameters:
        reference - name of this child-element.
    • Method Detail

      • setReferenceType

        public void setReferenceType​(java.lang.String reference)
        Makes the content particle represent the content with exactly one child-element.
        Parameters:
        reference - the name of this child-element - must not be null or equal to empty String.
      • isReferenceType

        public boolean isReferenceType()
        True if the content is exactly on child-element, false otherwise.
      • setSeqType

        public void setSeqType()
        Sets the content to sequence list of content particles.
      • isSeqType

        public boolean isSeqType()
        True if the content is a sequence list of content particles, false otherwise.
      • setChoiceType

        public void setChoiceType()
        Sets the content to choice list of content particles.
      • isChoiceType

        public boolean isChoiceType()
        True if the content is a choice list of content particles, false otherwise.
      • getReference

        public java.lang.String getReference()
        Returns the name of the child element, if content is exactly one child.
      • getChildren

        public java.util.Enumeration getChildren()
        Returns enumeration of the children - content particles, that form the content of this Content Particle, if has SEQ or CHOICE type (sequence or choice list), null otherwise.
      • setOneOccurance

        public void setOneOccurance()
        Sets occurance specification of the content particle to ONE.
      • isOneOccurance

        public boolean isOneOccurance()
        True if ocurence specification of the content particle is ONE, false otherwise.
      • setZeroOrOneOccurance

        public void setZeroOrOneOccurance()
        Sets occurance specification of the content particle to ZERO_OR_ONE.
      • isZeroOrOneOccurance

        public boolean isZeroOrOneOccurance()
        True if occurance specification of the content particle is ZERO_OR_ONE, false otherwise.
      • setOneOrMoreOccurances

        public void setOneOrMoreOccurances()
        Sets occurance specification of the content particle to ONE_OR_MORE.
      • isOneOrMoreOccurances

        public boolean isOneOrMoreOccurances()
        True if occurance specification of the content particle is ONE_OR_MORE, false otherwise.
      • setZeroOrMoreOccurances

        public void setZeroOrMoreOccurances()
        Sets occurance specification of the content particle to ZERO_OR_MORE.
      • isZeroOrMoreOccurances

        public boolean isZeroOrMoreOccurances()
        True if occurance specification of the content particle is ZERO_OR_MORE, false otherwise.
      • addChild

        public void addChild​(ContentParticle cp)
        Adds child to the vector of child elements (content particles).
        Parameters:
        cp - content particle to add to the vector of children.