Class ALcdDAFIFMultiModelDecoder
- All Implemented Interfaces:
ILcdDAFIFDecoder,ILcdDAFIFMultiModelDecoder,ILcdInputStreamFactoryCapable,ILcdModelDecoder
- Direct Known Subclasses:
TLcdDAFIFAerodromeNavaidDecoder,TLcdDAFIFILSDecoder,TLcdDAFIFNavaidDecoder,TLcdDAFIFRefuelingTrackDecoder,TLcdDAFIFVFRRouteDecoder
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.
-
Field Summary
Fields inherited from class com.luciad.format.dafif.decoder.ALcdDAFIFDecoder
DAFIF_PROP_EXTENSION, fRecordCount -
Constructor Summary
ConstructorsConstructorDescriptionALcdDAFIFMultiModelDecoder(Properties aDAFIFProperties) Initializes the DAFIFProperties field with the specified properties object. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcleanUp()This method should be implemented by a concrete class.protected abstract ILcdModelDescriptorcreateModelDescriptor(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 thedecodemethod).abstract TLcdEditableModelListDescriptorcreateModelDescriptor(String aSource) Creates and returns the model descriptor to be set on the model returned in the decode method.Returns a model containing one or more submodels.intReturns the number of models that will be available in the model produced by thedecodemethod.protected abstract voidhandleRecord(int aFormat, char[] aRecord) Deals with one record of input.protected voidThis method is usually not implemented.voidsetKeyFeatureNames(int aIndex, String[] aKeyFeatureNames) Specifies for each submodel anArrayobject containing the names of the features that will be used as a key to insert objects into the submodel.voidsetModelCount(int aNumberOfModels) Specifies the number of submodels that will be decoded using this decoder.Methods inherited from class com.luciad.format.dafif.decoder.ALcdDAFIFDecoder
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, transformPointToReferenceDatumSFCTMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.luciad.format.dafif.decoder.ILcdDAFIFDecoder
getBounds, getDAFIFProperties, getDataObjectFactory, getDecodeFileName, getDecodingBounds, getDomainFactory, getErrorMessage, setBounds, setDAFIFModelFilter, setDAFIFProperties, setDataObjectFactory, setDecodingBounds, setDomainFactory, setStoreOriginalReferenceMethods inherited from interface com.luciad.model.ILcdModelDecoder
canDecodeSource, canDecodeSource, decodeModelMetadata, decodeModelMetadata, decodeSource, discoverDataSources, getDisplayName
-
Constructor Details
-
ALcdDAFIFMultiModelDecoder
Initializes the DAFIFProperties field with the specified properties object. This object may be null.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.
- Parameters:
aDAFIFProperties- aPropertiesobject containing for each domain object the name of its data file or NULL
-
-
Method Details
-
cleanUp
protected void cleanUp()Description copied from class:ALcdDAFIFDecoderThis method should be implemented by a concrete class.It should empty all temporary data structures used during the decoding process.
- Specified by:
cleanUpin classALcdDAFIFDecoder
-
setModelCount
public void setModelCount(int aNumberOfModels) Description copied from interface:ILcdDAFIFMultiModelDecoderSpecifies the number of submodels that will be decoded using this decoder.Note: this method should be called before calling the decode method.
- Specified by:
setModelCountin interfaceILcdDAFIFMultiModelDecoder- Parameters:
aNumberOfModels- the number of submodels in the model produced by this decoder- See Also:
-
getModelCount
public int getModelCount()Description copied from interface:ILcdDAFIFMultiModelDecoderReturns the number of models that will be available in the model produced by thedecodemethod.- Specified by:
getModelCountin interfaceILcdDAFIFMultiModelDecoder- Returns:
- the number of submodels in the model produced by this decoder
- See Also:
-
createModelDescriptor
Description copied from interface:ILcdDAFIFMultiModelDecoderCreates and returns the model descriptor to be set on the model returned in the decode method.- Specified by:
createModelDescriptorin interfaceILcdDAFIFMultiModelDecoder- Parameters:
aSource- the source that will be used to build the model- Returns:
- the model descriptor to be set on the model produced by this decoder
-
decode
Returns a model containing one or more submodels. Each submodel contains domain objects of the same type (e.g. a navaid model will contain four submodels; a TACAN, a VOR a NDB and a DME model).The submodels will be build by looping through the records found in the source file. Each record will be manipulated by the abstract
handleRecordmethod.Furthermore, the error message will be initialized and filled with reports about errors occurred during the decode process.
- Specified by:
decodein interfaceILcdModelDecoder- Parameters:
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 (seegetDecodeFileName()).- Returns:
- the model build by reading the file found with aSource
- Throws:
IOException- if an error occurs during the reading process- See Also:
-
setKeyFeatureNames
Specifies for each submodel anArrayobject 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).
- Parameters:
aIndex- the index of the submodel whose keyFeatureNames are being specifiedaKeyFeatureNames- anArrayobject containing the names of the features that will be used as a key to insert objects into the model
-
handleRecord
protected abstract void handleRecord(int aFormat, char[] aRecord) Deals with one record of input.- Parameters:
aFormat- the format of the recordaRecord- the record to deal with
-
createModelDescriptor
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 thedecodemethod).- Parameters:
aSource- the source to be decoded- Returns:
- a model descriptor describing the data in the submodel at position aIndex in the model produced by this decoder
-
postProcess
protected void postProcess()This method is usually not implemented. However in some cases it may be useful for decoders to perform some actions after reading all records, but before the different models are merged into the modelList. In that case all those actions can be put in this method.
-