/** * Returns a copy of this map. Characteristics are also cloned. * * @return a copy of this map. */ @Override public CharacteristicMap clone() throws CloneNotSupportedException { final CharacteristicMap clone = (CharacteristicMap) super.clone(); AbstractAttribute<?>[] c = clone.characterizedBy; if (c != null) { clone.characterizedBy = c = c.clone(); final Cloner cloner = new Cloner(); for (int i=0; i<c.length; i++) { final AbstractAttribute<?> attribute = c[i]; if (attribute instanceof Cloneable) { c[i] = (AbstractAttribute<?>) cloner.clone(attribute); } } } return clone; }
/** * Returns a copy of this map. Characteristics are also cloned. * * @return a copy of this map. */ @Override public CharacteristicMap clone() throws CloneNotSupportedException { final CharacteristicMap clone = (CharacteristicMap) super.clone(); AbstractAttribute<?>[] c = clone.characterizedBy; if (c != null) { clone.characterizedBy = c = c.clone(); final Cloner cloner = new Cloner(); for (int i=0; i<c.length; i++) { final AbstractAttribute<?> attribute = c[i]; if (attribute instanceof Cloneable) { c[i] = (AbstractAttribute<?>) cloner.clone(attribute); } } } return clone; }
case VALUES: break; // Nothing to do. case PROPERTIES: { final Cloner cloner = new Cloner(); for (final Map.Entry<Integer,Object> entry : clone.properties.entrySet()) { final Property property = (Property) entry.getValue();
/** * Returns a copy of this feature * This method clones also all {@linkplain Cloneable cloneable} property instances in this feature, * but not necessarily property values. Whether the property values are cloned or not (i.e. whether * the clone operation is <cite>deep</cite> or <cite>shallow</cite>) depends on the behavior or * property {@code clone()} methods. * * @return a clone of this attribute. * @throws CloneNotSupportedException if this feature can not be cloned, typically because * {@code clone()} on a property instance failed. */ @Override public DenseFeature clone() throws CloneNotSupportedException { final DenseFeature clone = (DenseFeature) super.clone(); clone.properties = clone.properties.clone(); if (clone.properties instanceof Property[]) { final Property[] p = (Property[]) clone.properties; final Cloner cloner = new Cloner(); for (int i=0; i<p.length; i++) { final Property property = p[i]; if (property instanceof Cloneable) { p[i] = (Property) cloner.clone(property); } } } return clone; }
/** * Returns a copy of this feature * This method clones also all {@linkplain Cloneable cloneable} property instances in this feature, * but not necessarily property values. Whether the property values are cloned or not (i.e. whether * the clone operation is <cite>deep</cite> or <cite>shallow</cite>) depends on the behavior or * property {@code clone()} methods. * * @return a clone of this attribute. * @throws CloneNotSupportedException if this feature can not be cloned, typically because * {@code clone()} on a property instance failed. */ @Override public DenseFeature clone() throws CloneNotSupportedException { final DenseFeature clone = (DenseFeature) super.clone(); clone.properties = clone.properties.clone(); if (clone.properties instanceof Property[]) { final Property[] p = (Property[]) clone.properties; final Cloner cloner = new Cloner(); for (int i=0; i<p.length; i++) { final Property property = p[i]; if (property instanceof Cloneable) { p[i] = (Property) cloner.clone(property); } } } return clone; }
case VALUES: break; // Nothing to do. case PROPERTIES: { final Cloner cloner = new Cloner(); for (final Map.Entry<Integer,Object> entry : clone.properties.entrySet()) { final Property property = (Property) entry.getValue();
cloner = new Cloner(false);