Class Multitag


  • public class Multitag
    extends java.lang.Object
    A tag that can have child tags
    Author:
    alex
    • Constructor Summary

      Constructors 
      Constructor Description
      Multitag​(java.lang.String name)
      Creates a multitag based on name
      Multitag​(java.lang.String name, java.util.ArrayList<Tag> subtags, java.util.ArrayList<Multitag> subMultitags)
      Creates a multitag based on its name and children
      Multitag​(java.util.ArrayList<Tag> subtags, java.util.ArrayList<Multitag> subMultitags)
      Creates a multitag based on its children
      Multitag​(Multitag m)
      Copy constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void addMultitag​(Multitag tag)
      Adds a multitag as a child
      void addTag​(Tag tag)
      Adds a tag as a child
      boolean equals​(java.lang.Object obj)  
      Tag getDirectChild​(java.lang.String name)
      Gets a direct child tag based off name.
      java.lang.String getEnd()
      Gets the end of a tag's string
      Multitag getMultitag​(java.lang.String name)
      Gets a descendent multitag based on name.
      java.lang.String getName()
      Gets the name of the multitag
      java.lang.String getStart()
      Gets the start of a tag's string
      java.util.ArrayList<Multitag> getSubMultitags()
      Gets a list of all direct child Multitag objects
      java.util.ArrayList<Tag> getSubtags()
      Gets a list of all direct child Tag objects
      Tag getTag​(java.lang.String name)
      Gets a descendent tag based off name.
      java.util.ArrayList<Tag> getUnattachedData()
      Gets data attached to a multitag but not exactly attached to any subtag
      boolean isEqual​(Multitag tag)
      Deprecated.
      boolean isSameTag​(Multitag tag)
      Checks if two multitags are the same type
      protected void setName​(java.lang.String name)
      Sets the name of the multitag
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • Multitag

        public Multitag​(java.lang.String name,
                        java.util.ArrayList<Tag> subtags,
                        java.util.ArrayList<Multitag> subMultitags)
        Creates a multitag based on its name and children
        Parameters:
        name - The name of the multitag
        subtags - Tag objects that are a part of this multitag
        subMultitags - Multitag objects that are a part of this multitag
      • Multitag

        public Multitag​(java.util.ArrayList<Tag> subtags,
                        java.util.ArrayList<Multitag> subMultitags)
        Creates a multitag based on its children
        Parameters:
        subtags - Tag objects that are a part of this multitag
        subMultitags - Multitag objects that are a part of this multitag
      • Multitag

        public Multitag​(java.lang.String name)
        Creates a multitag based on name
        Parameters:
        name - The name of the multitag
      • Multitag

        public Multitag​(Multitag m)
        Copy constructor
        Parameters:
        m - The multitag to copy
    • Method Detail

      • getName

        public java.lang.String getName()
        Gets the name of the multitag
        Returns:
        the name of the multitag
      • setName

        protected void setName​(java.lang.String name)
        Sets the name of the multitag
        Parameters:
        name - the new name of the multitag
      • getSubtags

        public java.util.ArrayList<Tag> getSubtags()
        Gets a list of all direct child Tag objects
        Returns:
        A list of all direct child Tag objects
      • getSubMultitags

        public java.util.ArrayList<Multitag> getSubMultitags()
        Gets a list of all direct child Multitag objects
        Returns:
        A list of all direct child Multitag objects
      • addTag

        public void addTag​(Tag tag)
        Adds a tag as a child
        Parameters:
        tag - The child tag to add
      • addMultitag

        public void addMultitag​(Multitag tag)
        Adds a multitag as a child
        Parameters:
        tag - The child multitag to add
      • isSameTag

        public boolean isSameTag​(Multitag tag)
        Checks if two multitags are the same type
        Parameters:
        tag - The multitag to check
        Returns:
        true if same type of tag, false otherwise
      • isEqual

        @Deprecated
        public boolean isEqual​(Multitag tag)
        Deprecated.
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

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

        public java.lang.String getStart()
        Gets the start of a tag's string
        Returns:
      • getEnd

        public java.lang.String getEnd()
        Gets the end of a tag's string
        Returns:
      • getMultitag

        public Multitag getMultitag​(java.lang.String name)
                             throws java.lang.Exception
        Gets a descendent multitag based on name. Child tag does not need to be direct.
        Parameters:
        name - The name to search for
        Returns:
        The multitag searched for
        Throws:
        java.lang.Exception - Thrown if no multitag was found
      • getDirectChild

        public Tag getDirectChild​(java.lang.String name)
                           throws java.lang.Exception
        Gets a direct child tag based off name.
        Parameters:
        name - The name of the tag to search for
        Returns:
        The tag searched for
        Throws:
        java.lang.Exception - thrown if there is no tag with that name
      • getUnattachedData

        public java.util.ArrayList<Tag> getUnattachedData()
        Gets data attached to a multitag but not exactly attached to any subtag
        Returns:
        All unattached data
      • getTag

        public Tag getTag​(java.lang.String name)
                   throws java.lang.Exception
        Gets a descendent tag based off name. Does not need to be a direct child
        Parameters:
        name - The name of the tag
        Returns:
        The tag searched for
        Throws:
        java.lang.Exception - thrown if a tag by the given name cannot be found