Class RelativePathStr


  • public class RelativePathStr
    extends java.lang.Object
    Keeps a copy of the String as a series of '../' (Dot-Dot's) the connects a Sub-Directory to some Root Parent-Directory.

    This class is vital to a (albeit a very small) sub-set of the operations of the Upgrade Process. When adding links to '.html', '.js' or even Image Files in the Root JavaDoc Directory, a quick way to obtain the necessary Path-String to the Root Directory can be extremely convenient.

    An instance of this class is always available from the main class JavaDocHTMLFile, using the public constant field JavaDocHTMLFile.dotDots.

    Example String's
    Some example of the values maintained by this class would include:
    Relative Path String Java-Doc HTML File
    "../../" javadoc/Torello/HTML/package-summary.html
    "../../" javadoc/Torello/Java/package-summary.html
    "../../../../" javadoc/Torello/HTML/Tools/Images/ImageScraper.html


    • Field Summary

       
      Serializable ID
      Modifier and Type Field
      protected static long serialVersionUID
       
      Relative-Path from a Java-Doc Sub-Directory to the Root JD-Directory - uses '/' as Path-Separator
      Modifier and Type Field
      String urls
       
      Relative-Path from a Java-Doc Sub-Directory to the Root JD-Directory - uses File.separator
      Modifier and Type Field
      String fileSystem
    • Constructor Summary

      Constructors 
      Constructor Description
      RelativePathStr​(String fileSystem)  
    • Method Summary

       
      Methods: class java.lang.Object
      Modifier and Type Method
      boolean equals​(Object other)
      int hashCode()
      String toString()
      • Methods inherited from class java.lang.Object

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

      • urls

        🡅  🡇     🗕  🗗  🗖
        public final java.lang.String urls
        Dot-Dot '../../', Relative-Path-String from the a Java-Doc Sub-Directory / Package-Directory to the Root JavaDoc-Directory.

        This String uses the forward-slash '/', which is the Directory Separator used by Web-Browsers in URL's.
      • fileSystem

        🡅  🡇     🗕  🗗  🗖
        public final java.lang.String fileSystem
        Dot-Dot '../../', Relative-Path-String from the a Java-Doc Sub-Directory / Package-Directory to the Root JavaDoc-Directory.

        This is the exact same Relative-Path-String as urls, but this String uses the File-System's File.separator between separate Directory-Names.

        This separator may be either a '/' Foward-Slash, or a '\ Backward-Slash. It is dependent on which Operating-System the Java Virtual Machine is currently running.

        MS-DOS Note:
        Most know that the '/' Foward-Slash is always used in UNIX, and by Web-Browsers URL's. Years ago, however, an MS-DOS / Windows Computer running Java would stick by its choice to use the '\' as a Path-Separator.

        In later releases of DOS / Windows, Microsoft actuallh decided to allow either the forward or backward slash as a Path-Separator. This decision, sort of, makes this class a little superfluous and out-dated. However, it was decided that choosing which String to use is best left as a choice to be made by the developer.
    • Method Detail

      • toString

        🡅  🡇     🗕  🗗  🗖
        public java.lang.String toString()
        Retrieve a String representation of 'this' instance's data.
        Overrides:
        toString in class java.lang.Object
        Returns:
        The contents of this class, converted to a String
        Code:
        Exact Method Body:
         return
             "File-System Relative-Path to Root:  " + fileSystem + '\n' +
             "Browsser-URL Relative-Path to Root: " + urls + '\n';
        
      • hashCode

        🡅  🡇     🗕  🗗  🗖
        public int hashCode()
        Generates a Hash-Table's Hash-Code for 'this' instance's data.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        An integer that may be used for hashing 'this' instance.
        Code:
        Exact Method Body:
         return fileSystem.hashCode();
        
      • equals

        🡅     🗕  🗗  🗖
        public boolean equals​(java.lang.Object other)
        Checks whether 'this' equals 'other'
        Overrides:
        equals in class java.lang.Object
        Returns:
        TRUE if 'this' equals 'other'
        Code:
        Exact Method Body:
         if (! RelativePathStr.class.isAssignableFrom(other.getClass())) return false;
        
         RelativePathStr o = (RelativePathStr) other;
        
         return this.fileSystem.equals(o.fileSystem) &&  this.urls.equals(o.urls);