}
private static PathSegment getPathSegment(NamePart n) {
PathSegment child = n.hasChild() ? getPathSegment(n.getChild()) : null;
if (n.getType() == Type.ARRAY) {
return new ArraySegment(child);
} else {
return new NameSegment(n.getName(), child);
}
}