Package adams.core

Class RObjectPath

    • Field Detail

      • m_Parts

        protected String[] m_Parts
        the elements of the path.
      • m_FullPath

        protected String m_FullPath
        the full path.
    • Constructor Detail

      • RObjectPath

        public RObjectPath()
        Initializes the path.
      • RObjectPath

        public RObjectPath​(String path)
        Initializes the path.
        Parameters:
        path - the path to break up
      • RObjectPath

        public RObjectPath​(String[] path)
        Initializes the path with the specified elements.
        Parameters:
        path - the path elements to use
    • Method Detail

      • isEmpty

        public boolean isEmpty()
        Returns whether the path is empty or not.
        Returns:
        true if empty
      • getPath

        public String[] getPath()
        Returns a clone of the path elements.
        Returns:
        the elements of the path
      • getPathCount

        public int getPathCount()
        Returns the number of path elements this path is made of.
        Returns:
        the number of path elements
      • getPathComponent

        public String getPathComponent​(int element)
        Returns the specified element of the path.
        Parameters:
        element - the index of the element to retrieve
        Returns:
        the specified path element
      • getParentPath

        public RObjectPath getParentPath()
        Returns the path without the last element.
        Returns:
        the new path
      • getChildPath

        public RObjectPath getChildPath()
        Returns the path without the first element.
        Returns:
        the new path
      • getLastPathComponent

        public String getLastPathComponent()
        Returns the last path component, if available.
        Returns:
        the last component, null if no path elements stored
      • getFirstPathComponent

        public String getFirstPathComponent()
        Returns the first path component, if available.
        Returns:
        the first component, null if no path elements stored
      • isDescendant

        public boolean isDescendant​(RObjectPath objectPath)
        Checks whether the specified object path is a descendant of this object path object. A path is always a descendant of itself. [a, b, c] is a descendant of [a, b] and so is [a, b], but not [a].
        Parameters:
        objectPath - the path to check whether it is a descendant
        Returns:
        true if a descendant
      • getCommonAncestor

        public RObjectPath getCommonAncestor​(RObjectPath objectPath)
        Returns the path that denotes the common ancestor of this and the specified object path.
        Parameters:
        objectPath - the object path to get the common ancestor for
        Returns:
        the common ancestor (can have length 0!)
      • addChild

        public RObjectPath addChild​(String path)
        Creates a new path object that is the direct descendant of this path.
        Parameters:
        path - the path element to use for the child
        Returns:
        the child
      • compareTo

        public int compareTo​(RObjectPath o)
        Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
        Specified by:
        compareTo in interface Comparable<RObjectPath>
        Parameters:
        o - the object to be compared.
        Returns:
        a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
        Throws:
        ClassCastException - if the specified object's type prevents it from being compared to this object.
      • equals

        public boolean equals​(Object o)
        Checks whether the provided object is the same as this one.
        Overrides:
        equals in class Object
        Returns:
        true if the object is an ActorPath and represents the same path elements
      • hashCode

        public int hashCode()
        Returns the hashcode of the underlying array.
        Overrides:
        hashCode in class Object
        Returns:
        the hashcode
      • toString

        public String toString()
        Returns the path as a single string.
        Overrides:
        toString in class Object
        Returns:
        the complete path