class CategoryPath implements Comparable<CategoryPath> {

	public boolean isAncestorOrSelf(CategoryPath categoryPath) {

		// Result categoryPath This
		// ------ --------------------- ------------------------
		// True   /                     /apple
		// False  /apple                /
		// True   /apple                /apple/sub
		// True   /apple                /apple
		// False  /app                  /apple
		// False  /pear                 /apple

		if (categoryPath.isRoot()) {
			return true;
		}

		if (isRoot()) {
			return false;
		}

		String otherCategory = categoryPath.getPath();
		String myCategory = getPath();
		if (!myCategory.startsWith(otherCategory)) {
			return false;
		}

		if (myCategory.length() == otherCategory.length()) {
			// categoryPath is the same as this 
			return true;
		}

		return myCategory.charAt(otherCategory.length()) == DELIMITER_CHAR;
	}

	public  CategoryPath(String path);
	public  CategoryPath(CategoryPath parent, String name);

}