package ee.shy.core;

import org.apache.commons.lang3.ArrayUtils;

public class TreePath implements Comparable<TreePath> {
    private final String[] pathStrings;

    private TreePath(String[] treePath) {
        this.pathStrings = treePath;
    }

    public TreePath() {
        this.pathStrings = new String[0];
    }

    public TreePath resolve(String str) {
        return new TreePath(ArrayUtils.addAll(pathStrings, str.split("/")));
    }

    public String toString() {
        return "/" + String.join("/", pathStrings);
    }

    @Override
    public int compareTo(TreePath o) {
        String[] oStringList = o.pathStrings;

        int iterCount = Math.min(pathStrings.length, oStringList.length);
        
        for (int i = 0; i < iterCount; i++) {
            int strCompareResult = pathStrings[i].compareTo(oStringList[i]);
            if(strCompareResult != 0) {
                return strCompareResult;
            }
        }

        return pathStrings.length - oStringList.length;
    }


}

@@ -60,16 +60,62 @@
 Utils;%0A%0A
+/**%0A * A class that handles trees' paths.%0A */%0A
 public c
@@ -199,24 +199,168 @@
 thStrings;%0A%0A
+    /**%0A     * Constructor to assign new array of path directories to new path.%0A     * @param treePath array of new path's directories.%0A     */%0A
     private 
@@ -425,32 +425,93 @@
 reePath;%0A    %7D%0A%0A
+    /**%0A     * Constructor to create new empty path.%0A     */%0A
     public TreeP
@@ -575,219 +575,953 @@
     
-public TreePath resolve(String str) %7B%0A        return new TreePath(ArrayUtils.addAll(pathStrings, str.split(%22/%22)));%0A    %7D%0A%0A    public String toString() %7B%0A        return %22/%22 + String.join(%22/%22, pathStrings);%0A    %7D%0A
+/**%0A     * Adds given String to end of current path%0A     * @param str String of directory that to add to path.%0A     * @return new TreePath object with given directory added to path.%0A     */%0A    public TreePath resolve(String str) %7B%0A        return new TreePath(ArrayUtils.addAll(pathStrings, str.split(%22/%22)));%0A    %7D%0A%0A    /**%0A     * Joins all the separate path strings together with %22/%22 separator and returns the path string.%0A     * @return path as String.%0A     */%0A    public String toString() %7B%0A        return %22/%22 + String.join(%22/%22, pathStrings);%0A    %7D%0A%0A    /**%0A     * Compares two TreePath objects.%0A     * @param o TreePath object to compare to.%0A     * @return a value of 0 if the objects are equal, a value greater than 0 if _ is bigger than _, a value less than%0A     * 0 if _ is smaller than _ and difference of the objects' string lists length if the objects' strings' values are%0A     * equal up to object's with shortest string list.%0A     */
 %0A   

Add javadoc for TreePath class