Package com.luciad.util
Class TLcdFeatureArray
java.lang.Object
com.luciad.util.TLcdFeatureArray
- All Implemented Interfaces:
ILcdFeatured
,Serializable
- Direct Known Subclasses:
TLcdFeaturedMultiShapeList
,TLcdFeaturedSingleShapeList
Array based implementation to hold values for the features of an object. The array is extensible in the sense that
a value can be set at any index. The internal representation is adapted to hold at least the number of
values equal to the index passed plus one.
- See Also:
-
Constructor Summary
ConstructorDescriptionCreates a feature array containing no values for features.TLcdFeatureArray
(Object[] aFeatureArray) Creates a feature array by passing the values of the features. -
Method Summary
Modifier and TypeMethodDescriptionboolean
canSetFeature
(int aIndex) Always returns true.getFeature
(int aIndex) Returns the value of the feature at the given index when a value is set for that index or a higher index.int
The highest index for which a feature value was set.void
setFeature
(int aIndex, Object aFeature) Sets the value for a feature at the given index.void
setFeatures
(Object[] aFeatureArray) Sets the values of all features at once.
-
Constructor Details
-
TLcdFeatureArray
public TLcdFeatureArray()Creates a feature array containing no values for features. Set the value of at least one feature at an index i before requesting the value of a feature with index smaller than i. -
TLcdFeatureArray
Creates a feature array by passing the values of the features.- Parameters:
aFeatureArray
- the values of the features.
-
-
Method Details
-
setFeatures
Sets the values of all features at once. Note that no features at an index beyond the length of this array can be retrieved unless a value is set at an index equal to or higher than the length.- Parameters:
aFeatureArray
- the values of the features.
-
getFeatureCount
public int getFeatureCount()The highest index for which a feature value was set. Note that the feature value may have been null.- Specified by:
getFeatureCount
in interfaceILcdFeatured
- Returns:
- highest index for which a feature value was set. Note that the feature value may have been null.
-
getFeature
Returns the value of the feature at the given index when a value is set for that index or a higher index. Otherwise an IndexOutOfBoundsException is thrown.- Specified by:
getFeature
in interfaceILcdFeatured
- Parameters:
aIndex
- the index of the value to retrieve a value for.- Returns:
- the value of the feature at the given index.
- Throws:
IndexOutOfBoundsException
- when the index passed is higher than the highest index for which a value was set.- See Also:
-
setFeature
Sets the value for a feature at the given index. The internal representation will be extended to be able to contain at least aIndex+1 features.- Specified by:
setFeature
in interfaceILcdFeatured
- Parameters:
aIndex
- the index of the feature for which the value is intended for.aFeature
- the value of the feature.- See Also:
-
canSetFeature
public boolean canSetFeature(int aIndex) Always returns true.- Specified by:
canSetFeature
in interfaceILcdFeatured
- Parameters:
aIndex
- not taken into account.- Returns:
- always true.
-