@Override
 public NameSegment cloneWithNewChild(PathSegment newChild) {
   NameSegment s = new NameSegment(this.path);
   if (child != null) {
     s.setChild(child.cloneWithNewChild(newChild));
   } else {
     s.setChild(newChild);
   }
   return s;
 }
 @Override
 public NameSegment clone() {
   NameSegment s = new NameSegment(this.path);
   if (child != null) s.setChild(child.clone());
   return s;
 }