/** * 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 clone of this table. This method clones the {@linkplain #getRoot() root} node. * If the root is an instance of {@link Node}, then cloning the root will recursively clone * all its {@linkplain Node#getChildren() children}. * * @return a clone of this table. * @throws CloneNotSupportedException if this table, the root node or one of its children * can not be cloned. * * @see Node#clone() */ @Override public DefaultTreeTable clone() throws CloneNotSupportedException { final DefaultTreeTable clone = (DefaultTreeTable) super.clone(); clone.root = (TreeTable.Node) Cloner.cloneIfPublic(clone.root); return clone; }
return super.clone(object);
/** * 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 clone of this table. This method clones the {@linkplain #getRoot() root} node. * If the root is an instance of {@link Node}, then cloning the root will recursively clone * all its {@linkplain Node#getChildren() children}. * * @return a clone of this table. * @throws CloneNotSupportedException if this table, the root node or one of its children * can not be cloned. * * @see Node#clone() */ @Override public DefaultTreeTable clone() throws CloneNotSupportedException { final DefaultTreeTable clone = (DefaultTreeTable) super.clone(); clone.root = (TreeTable.Node) Cloner.cloneIfPublic(clone.root); 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; }
/** * If the value is cloneable, clones it before to return it. */ @Override public T getValue() { T value = super.getValue(); if (value instanceof Cloneable) try { value = getDescriptor().getValueClass().cast(Cloner.cloneIfPublic(value)); } catch (CloneNotSupportedException e) { throw new UnsupportedOperationException(Errors.format(Errors.Keys.CloneNotSupported_1, value.getClass()), e); } return value; }
/** * 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; }
/** * If the value is cloneable, clones it before to return it. */ @Override public T getValue() { T value = super.getValue(); if (value instanceof Cloneable) try { value = getDescriptor().getValueClass().cast(Cloner.cloneIfPublic(value)); } catch (CloneNotSupportedException e) { throw new UnsupportedOperationException(Errors.format(Errors.Keys.CloneNotSupported_1, value.getClass()), e); } return value; }
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(); if (property instanceof Cloneable) { entry.setValue(cloner.clone(property));
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(); if (property instanceof Cloneable) { entry.setValue(cloner.clone(property));