@Override public String getId() { return isSetId() ? id : ""; }
@Override public void setName(String name) { // removed the call to the trim() function as a name with only space // should be considered valid. String oldName = this.name; if ((name == null) || (name.length() == 0)) { this.name = null; } else { this.name = name; } if (!isSetId() && (getLevel() == 1)) { /* * Note: In Level 1 there is no id attribute but the name is actually the * id. Since Level 2 the name attribute has been intended to be a human-readable * name, not a unique identifier (this was the meaning in Level 1). JSBML therefore * has to set the id (and not the name) when calling this method in Level 1 models. */ setId(name); } else { // else part to avoid calling this method twice. firePropertyChange(TreeNodeChangeEvent.name, oldName, this.name); } }
@Override public int hashCode() { final int prime = 773; int hashCode = super.hashCode(); if (isSetMetaId()) { hashCode += prime * getMetaId().hashCode(); } if (isSetId()) { hashCode += prime * getId().hashCode(); } if (isSetName()) { hashCode += prime * getName().hashCode(); } if (isSetSBOTerm()) { hashCode += prime * getSBOTerm(); } if (elementNamespace != null) { hashCode = prime * hashCode + elementNamespace.hashCode(); } if (declaredNamespaces != null) { hashCode = prime * hashCode + declaredNamespaces.hashCode(); } // Notes, Annotation and extension SBasePlugins are taken into account in // AbstractTreeNode.hashCode() // as they are part of the children returned by #getChildAt(int i) return hashCode + prime * getLevelAndVersion().hashCode(); }
if (isSetId()) { if (getLevel() != 1) { attributes.put("id", getId());