/** * Clones this <code>IChemObject</code>. It clones the identifier, flags, * properties and pointer vectors. The ChemObjectListeners are not cloned, and * neither is the content of the pointer vectors. * *@return The cloned object */ @Override public Object clone() throws CloneNotSupportedException { ChemObject clone = (ChemObject) super.clone(); // clone the flags clone.flags = this.getFlagValue(); // clone the properties - using the HashMap copy constructor // this does not deep copy all objects but this was not done // originally if (properties != null) { clone.properties = new HashMap<Object, Object>(getProperties()); } return clone; }
/** * Clones this <code>IChemObject</code>. It clones the identifier, flags, * properties and pointer vectors. The ChemObjectListeners are not cloned, and * neither is the content of the pointer vectors. * *@return The cloned object */ @Override public Object clone() throws CloneNotSupportedException { ChemObject clone = (ChemObject) super.clone(); // clone the flags clone.flags = this.getFlagValue(); // clone the properties - using the HashMap copy constructor // this does not deep copy all objects but this was not done // originally if (properties != null) { clone.properties = new HashMap<Object, Object>(getProperties()); } return clone; }