Class GroupPath

  • All Implemented Interfaces:
    java.io.Serializable

    public class GroupPath
    extends java.lang.Object
    implements java.io.Serializable
    The GroupPath is a class to represent a unique path in a tree for a Group.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      GroupPath​(java.lang.String groupName)
      Construct a new GroupPath that is only a single level.
      GroupPath​(java.lang.String[] groupNames)
      Construct a new GroupPath with the given names.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      Group getGroup​(Program program, java.lang.String treeName)
      Get the Group for this group path object.
      java.lang.String getLastPathComponent()
      Get the last name in the path.
      GroupPath getParentPath()
      Get the parent path for this group.
      java.lang.String[] getPath()
      Return the array of names that make up this group's path.
      java.lang.String getPathComponent​(int index)
      Get the name at the given index into this group's path.
      int getPathCount()
      Get the number of names (levels) that make up this path.
      int hashCode()  
      boolean isDescendant​(GroupPath grpPath)
      Return true if the indicated group path is a descendent of this group path.
      GroupPath pathByAddingChild​(java.lang.String child)
      Create a new GroupPath object by adding the given child name to this group path.
      java.lang.String toString()
      Returns a string representation of this group path.
      void updateGroupPath​(java.lang.String oldname, java.lang.String newname)
      Update this group path with the new group name wherever the old group name is found.
      • Methods inherited from class java.lang.Object

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

      • GroupPath

        public GroupPath​(java.lang.String groupName)
        Construct a new GroupPath that is only a single level.
        Parameters:
        groupName - name of group
      • GroupPath

        public GroupPath​(java.lang.String[] groupNames)
        Construct a new GroupPath with the given names.
        Parameters:
        groupNames - group names. The first name is the oldest ancestor and the last name is the youngest descendant in the path.
    • Method Detail

      • updateGroupPath

        public void updateGroupPath​(java.lang.String oldname,
                                    java.lang.String newname)
        Update this group path with the new group name wherever the old group name is found.
        Parameters:
        oldname - old name
        newname - new name
      • equals

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

        public java.lang.String getLastPathComponent()
        Get the last name in the path.
        Returns:
        String
      • getGroup

        public Group getGroup​(Program program,
                              java.lang.String treeName)
        Get the Group for this group path object.
        Returns:
        null if there is no group with the name in this group path.
      • getParentPath

        public GroupPath getParentPath()
        Get the parent path for this group.
      • getPath

        public java.lang.String[] getPath()
        Return the array of names that make up this group's path.
      • getPathCount

        public int getPathCount()
        Get the number of names (levels) that make up this path.
      • getPathComponent

        public java.lang.String getPathComponent​(int index)
        Get the name at the given index into this group's path.
        Parameters:
        index - the index in the group path
      • isDescendant

        public boolean isDescendant​(GroupPath grpPath)
        Return true if the indicated group path is a descendent of this group path.
        Parameters:
        grpPath - the group path
      • pathByAddingChild

        public GroupPath pathByAddingChild​(java.lang.String child)
        Create a new GroupPath object by adding the given child name to this group path.
        Parameters:
        child - name of child to add to path
      • toString

        public java.lang.String toString()
        Returns a string representation of this group path.
        Overrides:
        toString in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
        See Also:
        Object.hashCode()