public String commonPrefix(PGridPath path) {
        if (path == null) {
            throw new NullPointerException();
        }

        int index = 1;
        String oPath = path.toString();

        while (path_.regionMatches(0, oPath, 0, index)) {
            index++;
        }
        index--;

        return path_.substring(0, index);
    }