//return the tree reference that corresponds to this tree element public TreeReference getRef() { TreeElement elem = this; TreeReference ref_ = TreeReference.selfRef(); while (elem != null) { TreeReference step; if (elem.name != null) { step = TreeReference.selfRef(); step.add(elem.name, elem.multiplicity); } else { step = TreeReference.rootRef(); } ref_ = ref_.parent(step); elem = elem.parent; } return(ref_); }