public boolean isAncestorOrSelf(CategoryPath candidateAncestorPath) {

		// Result candidateAncestor     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;
	}
Tests if the specified categoryPath is the same as, or an ancestor of, this category path.
@param candidateAncestorPath the category path to be checked.
@return true if the given path is the same as, or an ancestor of, this category path.
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/data/CategoryPath.java