Package com.luciad.util
Class TLcdFeatureArray
java.lang.Object
com.luciad.util.TLcdFeatureArray
- All Implemented Interfaces:
ILcdCloneable,ILcdFeatured,Serializable,Cloneable
- 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
ConstructorsConstructorDescriptionCreates 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 TypeMethodDescriptionbooleancanSetFeature(int aIndex) Always returns true.clone()MakesObject.clone()public.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.intThe highest index for which a feature value was set.voidsetFeature(int aIndex, Object aFeature) Sets the value for a feature at the given index.voidsetFeatures(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:
getFeatureCountin 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:
getFeaturein 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:
setFeaturein 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:
canSetFeaturein interfaceILcdFeatured- Parameters:
aIndex- not taken into account.- Returns:
- always true.
-
clone
Description copied from interface:ILcdCloneableMakes
When for example extending fromObject.clone()public.java.lang.Object, it can be implemented like this:public Object clone() { try { return super.clone(); } catch ( CloneNotSupportedException e ) { // Cannot happen: extends from Object and implements Cloneable (see also Object.clone) throw new RuntimeException( e ); } }- Specified by:
clonein interfaceILcdCloneable- Overrides:
clonein classObject- See Also:
-