DefaultCoverageDescription changes for revisions 24867:24990

Type of the attributeDescription property has been changed from Class to RecordType, and type of the dimension property has been changed from singleton to collection. Those changes were forced by GeoAPI change. Reverting those changes result in compilation error, and rewriting the contribution produce identical results since the new types are imposed by GeoAPI.

The contribution in equals, hashCode and freeze methods do not exist in SIS/Geotk, since those methods have been rewritten in order to use Java reflection.

Action: all contributions forced by changes in GeoAPI interfaces (mostly import statements and method signatures) have been rewritten from scratch by creating an empty Java class implementing the interface, clicking on the "Implement all abstract methods" contextual menu in NetBeans, removing the <? extends> part in parameterized type of collections, adding the synchronized keyword (for now) and finally adding the corresponding private fields. This action has been committed in the Apache SIS JDK7 branch at revision 1458238.

Command line:

svn diff --extensions "--unified --ignore-space-change --ignore-all-space --ignore-eol-style" -r24867:24990 https://svn.osgeo.org/geotools/trunk/modules/library/metadata/src/main/java/org/geotools/metadata/iso/content/CoverageDescriptionImpl.java
Revision 24867Revision 24990
package org.geotools.metadata.iso.content;

// Geotools dependencies
import org.opengis.metadata.content.CoverageDescription;

// OpenGIS dependencies
import org.geotools.resources.Utilities;
import org.opengis.metadata.content.CoverageContentType;
import org.opengis.metadata.content.RangeDimension;


/**
 * Information about the content of a grid data cell.
 *
 * @source $URL$
 * @version $Id$
 * @author Martin Desruisseaux
 * @author Touraïvane
 *
 * @since 2.1
 */
public class CoverageDescriptionImpl extends ContentInformationImpl implements CoverageDescription {
package org.geotools.metadata.iso.content;

// Geotools dependencies
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.Set;

import org.opengis.metadata.content.CoverageDescription;

// OpenGIS dependencies
import org.geotools.resources.Utilities;
import org.opengis.metadata.content.CoverageContentType;
import org.opengis.metadata.content.RangeDimension;
import org.opengis.util.MemberName;
import org.opengis.util.Record;
import org.opengis.util.RecordSchema;
import org.opengis.util.RecordType;
import org.opengis.util.TypeName;

/**
 * Information about the content of a grid data cell.
 *
 * @source $URL:
 *         http://svn.geotools.org/geotools/trunk/gt/modules/library/metadata/src/main/java/org/geotools/metadata/iso/content/CoverageDescriptionImpl.java $
 * @version $Id$
 * @author Martin Desruisseaux
 * @author Touraïvane
 * @since 2.1
 */
public class CoverageDescriptionImpl extends ContentInformationImpl implements CoverageDescription {
/**
 * Description of the attribute described by the measurement value.
 */
private Class attributeDescription;

/**
 * Type of information represented by the cell value.
/**
 * Description of the attribute described by the measurement value.
 */
private RecordType attributeDescription;

/**
 * Type of information represented by the cell value.
/**
 * Information on the dimensions of the cell measurement value.
 */
private RangeDimension dimension;

/**
 * Constructs an empty coverage description.
 */
public CoverageDescriptionImpl() {
/**
 * Information on the dimensions of the cell measurement value.
 * @deprecated
 */
private RangeDimension dimension;

/**
 * Information on the dimensions of the cell measurement value.
 */
private Collection dimensions;

/**
 * Constructs an empty coverage description.
 */
public CoverageDescriptionImpl() {
/**
 * Returns the description of the attribute described by the measurement value.
 */
public Class getAttributeDescription() {
    return attributeDescription;
}

/**
 * Set the description of the attribute described by the measurement value.
 */
public synchronized void setAttributeDescription(final Class newValue) {
    checkWritePermission();
    attributeDescription = newValue;
}
/**
 * Returns the description of the attribute described by the measurement value.
 */
public RecordType getAttributeDescription() {
    return attributeDescription;
}

/**
 * Set the description of the attribute described by the measurement value.
 */
public synchronized void setAttributeDescription(final RecordType newValue) {
    checkWritePermission();
    attributeDescription = newValue;
}
/**
 * Returns the information on the dimensions of the cell measurement value.
 */
public RangeDimension getDimension() {
    return dimension;
/**
 * Returns the information on the dimensions of the cell measurement value.
 *
 * @deprecated use getDimensions
 */
public RangeDimension getDimension() {
    return dimension;
/**
 * Set the information on the dimensions of the cell measurement value.
 */
public synchronized void setDimension(final RangeDimension newValue) {
    checkWritePermission();
/**
 * Set the information on the dimensions of the cell measurement value.
 *
 * @deprecated use setDimensions
 */
public synchronized void setDimension(final RangeDimension newValue) {
    checkWritePermission();
}

/**
 * Declare this metadata and all its attributes as unmodifiable.
 */
protected void freeze() {
    super.freeze();
    attributeDescription = (Class)          unmodifiable(attributeDescription);
    dimension            = (RangeDimension) unmodifiable(dimension);
}

/**
 * Compare this coverage description with the specified object for equality.
}

/**
 * Returns the information on the dimensions of the cell measurement value.
 *
 * @since 2.4
 */
public Collection getDimensions() {
    if (dimensions == null) {
        return Collections.singleton(dimension);
    }
    return dimensions;
}

/**
 * Set the information on the dimensions of the cell measurement value.
 *
 * since 2.4
 */
public synchronized void setDimensions(final Collection newValue) {
    checkWritePermission();
    dimensions = newValue;
}

/**
 * Declare this metadata and all its attributes as unmodifiable.
 */
protected void freeze() {
    super.freeze();
    attributeDescription = (RecordType) unmodifiable(attributeDescription);
    dimensions = (Collection) unmodifiable(dimensions);
    if (dimension != null) {
    dimension            = (RangeDimension) unmodifiable(dimension);
}
}

/**
 * Compare this coverage description with the specified object for equality.
    }
    if (super.equals(object)) {
        final CoverageDescriptionImpl that = (CoverageDescriptionImpl) object;
        return Utilities.equals(this.attributeDescription, that.attributeDescription ) &&
               Utilities.equals(this.contentType,          that.contentType          ) &&
               Utilities.equals(this.dimension,            that.dimension            )  ;
    }
    return false;
}

/**
 * Returns a hash code value for this coverage description. For performance reason, this
 * method do not uses all attributes for computing the hash code. Instead, it uses the
 * attributes that are the most likely to be unique.
 */
public synchronized int hashCode() {
    int code = (int)serialVersionUID;
    if (attributeDescription != null)  code ^= attributeDescription.hashCode();
    if (contentType          != null)  code ^= contentType         .hashCode();
    return code;
}
    }
    if (super.equals(object)) {
        final CoverageDescriptionImpl that = (CoverageDescriptionImpl) object;
        return Utilities.equals(this.attributeDescription, that.attributeDescription)
                && Utilities.equals(this.contentType, that.contentType)
                && Utilities.equals(this.dimensions, that.dimensions);
    }
    return false;
}

/**
 * Returns a hash code value for this coverage description. For performance reasons, this method
 * does not uses all attributes for computing the hash code. Instead, it uses the attributes that
 * are the most likely to be unique.
 */
public synchronized int hashCode() {
    int code = (int)serialVersionUID;
    if (attributeDescription != null)
        code ^= attributeDescription.hashCode();
    if (contentType != null)
        code ^= contentType.hashCode();
    return code;
}