public abstract class ALcdDAFIFMultiModelDecoder extends ALcdDAFIFDecoder implements ILcdDAFIFMultiModelDecoder
ALcdDAFIFDecoder
class defines
the skeleton of the decode algorithm used to decode DAFIF data files.
The decode method will loop through all records in the source file.
A concrete decoder can decide on what to do with each record by implementing the
handleRecord
method.
Extensions of the ALcdDAFIFMultiModelDecoder
class will produce
so-called "multi" models. A "multi" model contains several
submodels. The number of submodels should be specified by calling the
setModelCount
method.
DAFIF_PROP_EXTENSION, fRecordCount
Constructor and Description |
---|
ALcdDAFIFMultiModelDecoder(Properties aDAFIFProperties)
Initializes the DAFIFProperties field with the
specified properties object.
|
Modifier and Type | Method and Description |
---|---|
protected void |
cleanUp()
This method should be implemented by a concrete class.
|
protected abstract ILcdModelDescriptor |
createModelDescriptor(int aIndex,
String aSource)
Creates and returns the model descriptor to be set on the model with index aIndex
in the model (i.e. in the model returned in the
decode method). |
abstract TLcdEditableModelListDescriptor |
createModelDescriptor(String aSource)
Creates and returns the model descriptor to be set on the model returned in the
decode method.
|
ILcdModel |
decode(String aSource)
Returns a model containing one or more submodels.
|
int |
getModelCount()
Returns the number of models that will be available
in the model produced by the
decode method. |
protected abstract void |
handleRecord(int aFormat,
char[] aRecord)
Deals with one record of input.
|
protected void |
postProcess()
This method is usually not implemented.
|
void |
setKeyFeatureNames(int aIndex,
String[] aKeyFeatureNames)
Specifies for each submodel an
Array object containing the names of the features
that will be used as a key to insert objects into the submodel. |
void |
setModelCount(int aNumberOfModels)
Specifies the number of submodels that will be decoded
using this decoder.
|
addErrorReport, canDecodeSource, getAltitudeType, getBearingTypeForChar, getBounds, getDAFIFProperties, getDataObjectFactory, getDecodingBounds, getDisplayName, getDomainFactory, getErrorMessage, getInputStream, getInputStreamFactory, getLocalHorizontalDatum, getModelFilter, getRecordCount, initializeErrorMessage, isStoreOriginalReference, isTraceOn, loadCFGProperties, read, readExactValue, readFormat, readMinLength, readRecord, setBounds, setDAFIFModelFilter, setDAFIFProperties, setDataObjectFactory, setDecodingBounds, setDomainFactory, setInputStreamFactory, setStoreOriginalReference, setTraceOn, transformPointToReferenceDatumSFCT
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getBounds, getDAFIFProperties, getDataObjectFactory, getDecodeFileName, getDecodingBounds, getDomainFactory, getErrorMessage, setBounds, setDAFIFModelFilter, setDAFIFProperties, setDataObjectFactory, setDecodingBounds, setDomainFactory, setStoreOriginalReference
canDecodeSource, canDecodeSource, decodeModelMetadata, decodeModelMetadata, decodeSource, discoverDataSources, getDisplayName
public ALcdDAFIFMultiModelDecoder(Properties aDAFIFProperties)
If you don't have a properties object here, you can still specify it by decoding a .toc file containing the dafif properties. The decoder will read the properties from the .toc file and look for the data file to be decoded in the directory containing this .toc file.
aDAFIFProperties
- a Properties
object containing for each domain
object the name of its data file or NULLprotected void cleanUp()
ALcdDAFIFDecoder
It should empty all temporary data structures used during the decoding process.
cleanUp
in class ALcdDAFIFDecoder
public void setModelCount(int aNumberOfModels)
ILcdDAFIFMultiModelDecoder
Note: this method should be called before calling the decode method.
setModelCount
in interface ILcdDAFIFMultiModelDecoder
aNumberOfModels
- the number of submodels in the model produced by this decoderILcdDAFIFMultiModelDecoder.getModelCount()
public int getModelCount()
ILcdDAFIFMultiModelDecoder
decode
method.getModelCount
in interface ILcdDAFIFMultiModelDecoder
ILcdDAFIFMultiModelDecoder.setModelCount(int)
public abstract TLcdEditableModelListDescriptor createModelDescriptor(String aSource)
ILcdDAFIFMultiModelDecoder
createModelDescriptor
in interface ILcdDAFIFMultiModelDecoder
aSource
- the source that will be used to build the modelpublic ILcdModel decode(String aSource) throws IOException
The submodels will be build by looping through the records found in the source file.
Each record will be manipulated by the abstract handleRecord
method.
Furthermore, the error message will be initialized and filled with reports about errors occurred during the decode process.
decode
in interface ILcdModelDecoder
aSource
- either the directory containing the DAFIF source file to decode (if you did not
specify a properties file in the constructor, the default file name will be used), a .toc file
containing the DAFIF properties (the data file should be in the same directory as the .toc file)
or a single file which name corresponds to the file name associated with this decoder
(see getDecodeFileName()
).IOException
- if an error occurs during the reading processILcdModelDecoder.canDecodeSource(String)
public void setKeyFeatureNames(int aIndex, String[] aKeyFeatureNames)
Array
object containing the names of the features
that will be used as a key to insert objects into the submodel.
Please retrieve these feature names from the feature interfaces corresponding with the domain objects (e.g. com.luciad.ais.model.aerodrome.ILcdAerodromeFeature).
aIndex
- the index of the submodel whose keyFeatureNames are being specifiedaKeyFeatureNames
- an Array
object containing the names of the features
that will be used as a key to insert objects into the modelprotected abstract void handleRecord(int aFormat, char[] aRecord)
aFormat
- the format of the recordaRecord
- the record to deal withprotected abstract ILcdModelDescriptor createModelDescriptor(int aIndex, String aSource)
decode
method).aSource
- the source to be decodedprotected void postProcess()