| java.util.AbstractList org.geotools.coverage.CategoryList
All known Subclasses: org.geotools.coverage.GeophysicsCategoryList,
CategoryList | class CategoryList extends AbstractList implements MathTransform1D,Comparator,Serializable(Code) | | An immutable list of categories. Categories are sorted by their sample values.
Overlapping ranges of sample values are not allowed. A
CategoryList can
contains a mix of qualitative and quantitative categories. The
CategoryList.getCategory method is responsible for finding the right category for an arbitrary sample value.
Instances of
CategoryList are immutable and thread-safe.
since: 2.1 version: $Id: CategoryList.java 25449 2007-05-07 12:21:16Z desruisseaux $ author: Martin Desruisseaux |
Constructor Summary | |
public | CategoryList(Category[] categories, Unit units) Construct a category list using the specified array of categories. | | CategoryList(Category[] categories, Unit units, boolean searchNearest, CategoryList inverse) Construct a category list using the specified array of categories.
This constructor is for internal use only
It is not private only because
GeophysicsCategoryList need this constructor.
Parameters: categories - The list of categories. Parameters: units - The geophysics unit, or null if none. Parameters: searchNearest - The policy when CategoryList.getCategory doesn't find an exact matchfor a sample value. |
Method Summary | |
static int | binarySearch(double[] array, double key) Effectue une recherche bi-linéaire de la valeur spécifiée. | final public int | compare(Object o1, Object o2) Compare
Category objects according their
Category.minimum value. | final public Matrix | derivative(DirectPosition point) Gets the derivative of this transform at a point. | final public double | derivative(double value) Gets the derivative of this function at a value.
Parameters: value - The value where to evaluate the derivative. | public boolean | equals(Object object) Compares the specified object with this category list for equality. | StringBuffer | format(double value, boolean writeUnits, Locale locale, StringBuffer buffer) Format the specified value using the specified locale convention. | final public String | format(double value, Locale locale) Format a sample value. | public CategoryList | geophysics(boolean toGeophysics) If
toGeophysics is
true , returns a list of categories scaled
to geophysics values. | final public Object | get(int i) Returns the element at the specified position in this list. | final public Category | getCategory(double sample) Returns the category of the specified sample value.
If no category fits, then this method returns
null .
Parameters: sample - The value. | final public ColorModel | getColorModel(int visibleBand, int numBands) Returns a color model for this category list. | final public ColorModel | getColorModel(int visibleBand, int numBands, int type) Returns a color model for this category list. | final public InternationalString | getName() Returns the name of this object. | final public NumberRange | getRange() Returns the range of values in this category list. | final public int | getSourceDimensions() Gets the dimension of input points, which is 1. | final public int | getTargetDimensions() Gets the dimension of output points, which is 1. | public Unit | getUnits() Returns the unit information for quantitative categories in this list. | final public MathTransform | inverse() Returns the inverse transform of this object. | public boolean | isIdentity() Tests whether this transform does not move any points. | final boolean | isScaled(boolean toGeophysics) Verify if all categories are scaled to the specified state.
This is used mostly in assertion statements.
Parameters: toGeophysics - The state to test. | static boolean | isScaled(Category[] categories, boolean toGeophysics) Verify if all categories are scaled to the specified state.
Parameters: categories - The categories to test. Parameters: toGeophysics - The state to test. | static boolean | isSorted(Category[] categories) Vérifie si le tableau de catégories spécifié est bien en ordre croissant.
La comparaison ne tient pas compte des valeurs
NaN . | final public int | size() Returns the number of categories in this list. | final public Object[] | toArray() Returns all categories in this
CategoryList . | final public String | toString() Returns a string representation of this category list. | final String | toString(Object owner) Returns a string representation of this category list. | public String | toWKT() Returns a Well Known Text (WKT) for this object. | final public DirectPosition | transform(DirectPosition ptSrc, DirectPosition ptDst) Transforms the specified
ptSrc and stores the result in
ptDst . | final public double | transform(double value) Transforms the specified value.
Parameters: value - The value to transform. | final public void | transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) Transforms a list of coordinate point ordinal values. | final public void | transform(float[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts) Transforms a list of coordinate point ordinal values. | final public void | transform(WritableRectIter iterator) Transform a raster. |
inverse | final CategoryList inverse(Code) | | The inverse transform, never
null .
The following rule must hold:
|
nodata | final Category nodata(Code) | | The "nodata" category (never
null ). The "nodata" category is a
category mapping the geophysics
Double.NaN value. If none has been
found, a default "nodata" category is used. This category is used to transform
geophysics values to sample values into rasters when no suitable category has
been found for a given geophysics value.
|
CategoryList | public CategoryList(Category[] categories, Unit units) throws IllegalArgumentException(Code) | | Construct a category list using the specified array of categories.
Parameters: categories - The list of categories. Parameters: units - The geophysics unit, or null if none. throws: IllegalArgumentException - if two or more categorieshave overlapping sample value range. |
CategoryList | CategoryList(Category[] categories, Unit units, boolean searchNearest, CategoryList inverse) throws IllegalArgumentException(Code) | | Construct a category list using the specified array of categories.
This constructor is for internal use only
It is not private only because
GeophysicsCategoryList need this constructor.
Parameters: categories - The list of categories. Parameters: units - The geophysics unit, or null if none. Parameters: searchNearest - The policy when CategoryList.getCategory doesn't find an exact matchfor a sample value. true means that it should search for the nearestcategory, while false means that it should returns null . Parameters: inverse - The inverse transform, or null to build it automatically.This argument can be non-null only if invoked fromGeophysicsCategoryList constructor. throws: IllegalArgumentException - if two or more categories have overlapping sample valuerange. |
binarySearch | static int binarySearch(double[] array, double key)(Code) | | Effectue une recherche bi-linéaire de la valeur spécifiée. Cette
méthode est semblable à
Arrays.binarySearch(double[]double) ,
excepté qu'elle peut distinguer différentes valeurs de NaN.
Note: This method is not private in order to allows testing by
CategoryTest .
|
derivative | final public Matrix derivative(DirectPosition point) throws TransformException(Code) | | Gets the derivative of this transform at a point.
|
derivative | final public double derivative(double value) throws TransformException(Code) | | Gets the derivative of this function at a value.
Parameters: value - The value where to evaluate the derivative. The derivative at the specified point. throws: TransformException - if the derivative can't be evaluated at the specified point. |
equals | public boolean equals(Object object)(Code) | | Compares the specified object with this category list for equality.
If the two objects are instances of
CategoryList , then the
test is a little bit stricter than the default
AbstractList.equals .
|
format | StringBuffer format(double value, boolean writeUnits, Locale locale, StringBuffer buffer)(Code) | | Format the specified value using the specified locale convention. This method is to be
overridden by
GeophysicsCategoryList . The default implementation do not format
the value very properly, since most invocation will be done on
geophysics(true).format(...) anyway.
Parameters: value - The value to format. Parameters: writeUnit - true if unit symbol should be formatted after the number.Ignored if this category list has no unit. Parameters: locale - The locale, or null for a default one. Parameters: buffer - The buffer where to format. The buffer buffer for convenience. |
format | final public String format(double value, Locale locale)(Code) | | Format a sample value. If
value is a real number, then the value may
be formatted with the appropriate number of digits and the units symbol. Otherwise,
if
value is
NaN , then the category name is returned.
Parameters: value - The sample value (may be NaN ). Parameters: locale - Locale to use for formatting, or null for the default locale. A string representation of the sample value. |
geophysics | public CategoryList geophysics(boolean toGeophysics)(Code) | | If
toGeophysics is
true , returns a list of categories scaled
to geophysics values. This method always returns a list of categories in which
Category.geophysics(boolean) Category.geophysics (toGeophysics)
has been invoked for each category.
|
get | final public Object get(int i)(Code) | | Returns the element at the specified position in this list.
|
getCategory | final public Category getCategory(double sample)(Code) | | Returns the category of the specified sample value.
If no category fits, then this method returns
null .
Parameters: sample - The value. The category of the supplied value, or null . |
getColorModel | final public ColorModel getColorModel(int visibleBand, int numBands)(Code) | | Returns a color model for this category list. This method builds up the color model
from each category's colors (as returned by
Category.getColors ).
Parameters: visibleBand - The band to be made visible (usually 0). All other bands, if anywill be ignored. Parameters: numBands - The number of bands for the color model (usually 1). The returned colormodel will renderer only the visibleBand and ignore the others, butthe existence of all numBands will be at least tolerated. Supplementalbands, even invisible, are useful for processing with Java Advanced Imaging. The requested color model, suitable for RenderedImage objects with valuesin the CategoryList.getRange range. |
getColorModel | final public ColorModel getColorModel(int visibleBand, int numBands, int type)(Code) | | Returns a color model for this category list. This method builds up the color model
from each category's colors (as returned by
Category.getColors ).
Parameters: visibleBand - The band to be made visible (usually 0). All other bands, if anywill be ignored. Parameters: numBands - The number of bands for the color model (usually 1). The returned colormodel will renderer only the visibleBand and ignore the others, butthe existence of all numBands will be at least tolerated. Supplementalbands, even invisible, are useful for processing with Java Advanced Imaging. Parameters: type - The transfer type used in the sample model The requested color model, suitable for RenderedImage objects with valuesin the CategoryList.getRange range. |
getName | final public InternationalString getName()(Code) | | Returns the name of this object. The default implementation returns the name
of what seems to be the "main" category (i.e. the quantitative category with
the widest range of sample values) followed by the geophysics value range.
|
getRange | final public NumberRange getRange()(Code) | | Returns the range of values in this category list. This is the union of the range
of values of every categories, excluding
NaN values. A
NumberRange object give more informations than
org.opengis.CV_SampleDimension.getMinimum and
org.opengis.CV_SampleDimension.getMaximum since it contains also the
type (integer, float, etc.) and inclusion/exclusion informations.
The range of values. May be null if this category list has noquantitative category. See Also: Category.getRange |
getSourceDimensions | final public int getSourceDimensions()(Code) | | Gets the dimension of input points, which is 1.
|
getTargetDimensions | final public int getTargetDimensions()(Code) | | Gets the dimension of output points, which is 1.
|
getUnits | public Unit getUnits()(Code) | | Returns the unit information for quantitative categories in this list. May returns
null if there is no quantitative categories in this list, or if there is no
unit information.
This method is to be overridden by
GeophysicsCategoryList . The default implementation
returns
null since sample values are not geophysics values as long as they have not
been transformed. The
GridSampleDimension class will invoke
geophysics(true).getUnits() in order to get a non-null unit.
|
inverse | final public MathTransform inverse()(Code) | | Returns the inverse transform of this object.
|
isIdentity | public boolean isIdentity()(Code) | | Tests whether this transform does not move any points.
|
isScaled | final boolean isScaled(boolean toGeophysics)(Code) | | Verify if all categories are scaled to the specified state.
This is used mostly in assertion statements.
Parameters: toGeophysics - The state to test. true if all categories are in the specified state. |
isScaled | static boolean isScaled(Category[] categories, boolean toGeophysics)(Code) | | Verify if all categories are scaled to the specified state.
Parameters: categories - The categories to test. Parameters: toGeophysics - The state to test. true if all categories are in the specified state. |
isSorted | static boolean isSorted(Category[] categories)(Code) | | Vérifie si le tableau de catégories spécifié est bien en ordre croissant.
La comparaison ne tient pas compte des valeurs
NaN . Cette
méthode n'est utilisée que pour les
assert .
|
size | final public int size()(Code) | | Returns the number of categories in this list.
|
toArray | final public Object[] toArray()(Code) | | Returns all categories in this
CategoryList .
|
toString | final public String toString()(Code) | | Returns a string representation of this category list.
The returned string is implementation dependent.
It is usually provided for debugging purposes only.
|
toString | final String toString(Object owner)(Code) | | Returns a string representation of this category list. The
owner argument allow for a different class name to be formatted.
|
transform | final public DirectPosition transform(DirectPosition ptSrc, DirectPosition ptDst) throws TransformException(Code) | | Transforms the specified
ptSrc and stores the result in
ptDst .
|
transform | final public double transform(double value) throws TransformException(Code) | | Transforms the specified value.
Parameters: value - The value to transform. the transformed value. throws: TransformException - if the value can't be transformed. |
transform | final public void transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) throws TransformException(Code) | | Transforms a list of coordinate point ordinal values.
|
transform | final public void transform(float[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts) throws TransformException(Code) | | Transforms a list of coordinate point ordinal values.
|
transform | final public void transform(WritableRectIter iterator) throws RasterFormatException(Code) | | Transform a raster. Only the current band in
iterator will be transformed.
The transformed value are write back in the
iterator . If a different
destination raster is wanted, a
org.geotools.image.TransfertRectIter may be used.
Parameters: iterator - An iterator to iterate among the samples to transform. throws: RasterFormatException - if a problem occurs during the transformation. |
Fields inherited from java.util.AbstractList | protected transient int modCount(Code)(Java Doc)
|
|
|