class CategoryPath implements Comparable<CategoryPath> {

	public boolean isAncestorOrSelf(CategoryPath candidateAncestorPath) {

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

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

		CategoryPath path = this;
		while (!path.isRoot()) {
			if (candidateAncestorPath.equals(path)) {
				return true;
			}
			path = path.getParent();
		}
		return false;
	}

	private  CategoryPath();
	public  CategoryPath(CategoryPath parent, String... subPathElements);
	public  CategoryPath(CategoryPath parent, List<String> subPathElements);
	public  CategoryPath(String path);

}