public class TLcdHashedFeaturedModelDescriptor extends TLcdModelDescriptor implementsILcdFeaturedDescriptor, ILcdDataModelDescriptor
ILcdModelDescriptor
that is also an ILcdFeaturedDescriptor
. It has a list of
feature names, along with their corresponding classes. Internally, a hashtable is
used to provide an efficient mapping from feature names to feature indices.
All elements of the corresponding model shall be ILcdFeatured
and shall have the same features.
Note that this model descriptor is a specific implementation to be used in the context of AIS. It is not a general purpose implementation that can be used to create a featured descriptor given a data type.
Constructor and Description |
---|
TLcdHashedFeaturedModelDescriptor(String aSourceName,
String aTypeName,
String aDisplayName,
ILcdFeaturedDescriptor aModelDescriptor)
|
TLcdHashedFeaturedModelDescriptor(String aSourceName,
String aTypeName,
String aDisplayName,
String[] aFeatureNames,
Class[] aFeatureClasses)
|
TLcdHashedFeaturedModelDescriptor(String aSourceName,
String aTypeName,
String aDisplayName,
TLcdDataType aElementType)
Constructs a new
TLcdHashedFeaturedModelDescriptor object. |
Modifier and Type | Method and Description |
---|---|
TLcdDataModel |
getDataModel()
Returns the data model that describes the elements of the model.
|
Class |
getFeatureClass(int aIndex)
Returns the
Class of the feature at the given index. |
int |
getFeatureCount()
Returns the number of features.
|
int |
getFeatureIndex(String aName)
Returns the index of the given feature name if it exists, -1 otherwise.
|
String |
getFeatureName(int aIndex)
Returns the name of the feature at the given index.
|
Set<TLcdDataType> |
getModelElementTypes()
Returns a singleton set that contains the type with which this object was created.
|
Set<TLcdDataType> |
getModelTypes()
Returns a set containing all the types of which instances can be used (including both
top-level elements and child objects) in the model associated with this descriptor.
|
getDisplayName, getSourceName, getTypeName, setDisplayName, setSourceName, setTypeName, sourceNameToDisplayName
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getFeatureUnitOfMeasure
getDisplayName, getSourceName, getTypeName
@Deprecated public TLcdHashedFeaturedModelDescriptor(String aSourceName, String aTypeName, String aDisplayName, String[] aFeatureNames, Class[] aFeatureClasses)
TLcdHashedFeaturedModelDescriptor
object.aSourceName
- the name of the data sourceaTypeName
- the type name of the data sourceaDisplayName
- the display name of the data sourceaFeatureNames
- the feature namesaFeatureClasses
- the feature classes@Deprecated public TLcdHashedFeaturedModelDescriptor(String aSourceName, String aTypeName, String aDisplayName, ILcdFeaturedDescriptor aModelDescriptor)
TLcdHashedFeaturedModelDescriptor
object.
This constructor is used to reuse an existing model descriptor, but change
the source, type and display name.aSourceName
- aTypeName
- aDisplayName
- aModelDescriptor
- public TLcdHashedFeaturedModelDescriptor(String aSourceName, String aTypeName, String aDisplayName, TLcdDataType aElementType)
TLcdHashedFeaturedModelDescriptor
object. The
aElementType
parameter will be used to determine the names and
classes of the features of the model elements.aSourceName
- the name of the data sourceaTypeName
- the type name of the data sourceaDisplayName
- the display name of the data sourceaElementType
- the data type of the elements that will be contained in the model
that uses this descriptor.public TLcdDataModel getDataModel()
Returns the data model that describes the elements of the model. Note that not necessarily all data in the model will be of a type of this data model. Very likely, types from the dependencies of the returned data model are used as well.
In case the model accepts objects from multiple data models, an anonymous
data model that depends on all these data models should be returned
(see TLcdDataModelBuilder.createAnonymousDataModel(java.util.Collection)
).
getDataModel
in interface ILcdDataModelDescriptor
public Set<TLcdDataType> getModelElementTypes()
TLcdUnknownDataTypes.UNKOWN_TYPE
is returned.getModelElementTypes
in interface ILcdDataModelDescriptor
public Set<TLcdDataType> getModelTypes()
Returns a set containing all the types of which instances can be used (including both top-level elements and child objects) in the model associated with this descriptor. Implementations are free to limit the result to only include the types of which there are actually instances in the model; but they are not required to do so.
A simple and correct implementation would be to return
getDataModel().getTypes()
. Implementations are encouraged to return a subset of
this set if they can do so without spending an unreasonable amount of resources.
Implementations should return null
in case they don't know
which types are present in the model.
getModelTypes
in interface ILcdDataModelDescriptor
public int getFeatureCount()
ILcdFeaturedDescriptor
getFeatureCount
in interface ILcdFeaturedDescriptor
public String getFeatureName(int aIndex)
ILcdFeaturedDescriptor
getFeatureName
in interface ILcdFeaturedDescriptor
aIndex
- a valid feature index.public int getFeatureIndex(String aName)
ILcdFeaturedDescriptor
getFeatureIndex
in interface ILcdFeaturedDescriptor
aName
- a feature name.public Class getFeatureClass(int aIndex)
ILcdFeaturedDescriptor
Class
of the feature at the given index.getFeatureClass
in interface ILcdFeaturedDescriptor
aIndex
- a valid feature index.Class
of the feature at the given index.