Package jmri.jmrit.decoderdefn
Class DecoderFile
java.lang.Object
jmri.jmrit.XmlFile
jmri.jmrit.decoderdefn.DecoderFile
Represents and manipulates a decoder definition, both as a file and in
memory. The internal storage is a JDOM tree.
This object is created by DecoderIndexFile to represent the decoder identification info _before_ the actual decoder file is read.
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class jmri.jmrit.XmlFile
XmlFile.Validate -
Field Summary
FieldsModifier and TypeFieldDescription(package private) String(package private) org.jdom2.Element(package private) String(package private) String(package private) String(package private) String(package private) String(package private) String(package private) int(package private) int(package private) String(package private) String(package private) String(package private) Stringstatic String(package private) int(package private) ArrayList<LocoAddress.Protocol>(package private) boolean[]Fields inherited from class jmri.jmrit.XmlFile
dtdLocation, xsltLocation -
Constructor Summary
ConstructorsConstructorDescriptionDecoderFile(String mfg, String mfgID, String model, String lowVersionID, String highVersionID, String family, String filename, int numFns, int numOuts, org.jdom2.Element decoder) Create a mechanism to manipulate a decoder definition from up to 10 parameters.DecoderFile(String mfg, String mfgID, String model, String lowVersionID, String highVersionID, String family, String filename, int numFns, int numOuts, org.jdom2.Element decoder, String replacementModel, String replacementFamily) Create a mechanism to manipulate a decoder definition from up to 12 parameters.DecoderFile(String mfg, String mfgID, String model, String lowVersionID, String highVersionID, String family, String filename, String developerID, String manufacturerID, String productID, int numFns, int numOuts, org.jdom2.Element decoder, String replacementModel, String replacementFamily) Create a mechanism to manipulate a decoder definition from up to 15 parameters.DecoderFile(String mfg, String mfgID, String model, String lowVersionID, String highVersionID, String family, String filename, String developerID, String manufacturerID, String productID, int numFns, int numOuts, org.jdom2.Element decoder, String replacementModel, String replacementFamily, String programmingModes) Create a mechanism to manipulate a decoder definition from up to 16 parameters. -
Method Summary
Modifier and TypeMethodDescriptionGet the (LocoNet SV2) "Developer ID" number.Get the (LocoNet SV2/Uhlenbrock LNCV) "Manufacturer ID" number.getMfg()getMfgID()static StringgetMfgName(org.jdom2.Element decoderElement) getModel()org.jdom2.ElementintintGet the "Product ID" value.Get all specified programming modes a decoder xml supports.static StringgetProgrammingModes(org.jdom2.Element decoderElement) boolean[]return array of versionsstatic booleanisIncluded(org.jdom2.Element e, String productID, String modelID, String familyID, String extraInclude, String extraExclude) (package private) booleanisProductIDok(org.jdom2.Element e, String extraInclude, String extraExclude) booleanisProgrammingMode(String mode) booleanisVersion(int i) Test for correct decoder version numbervoidloadExtraMenuModel(org.jdom2.Element decoderElement, ArrayList<ExtraMenuTableModel> extraMenuModelList, JLabel progStatus, Programmer mProgrammer) voidloadResetModel(org.jdom2.Element decoderElement, ResetTableModel resetModel) voidloadVariableModel(org.jdom2.Element decoderElement, VariableTableModel variableModel) Load a VariableTableModel for a given decoder Element, for the purposes of programming.voidprocessVariablesElement(org.jdom2.Element variablesElement, VariableTableModel variableModel, String extraInclude, String extraExclude) voidsetOneVersion(int i) voidsetVersionRange(int low, int high) voidsetVersionRange(String lowVersionID, String highVersionID) Convert to a canonical text form for ComboBoxes, etc.static StringtitleString(String model, String family) Methods inherited from class jmri.jmrit.XmlFile
addDefaultInfo, backupFileName, checkFile, createFileNameWithDate, dumpElement, findFile, getBuilder, getDefaultDtdLocation, getDefaultValidate, getDtdLocation, getProcessingInstructionHRef, getProcessingInstructionType, getRoot, getValidate, makeBackupFile, makeBackupFile, newDocument, newDocument, revertBackupFile, rootFromFile, rootFromInputStream, rootFromName, rootFromURL, setDefaultDtdLocation, setDefaultValidate, setDtdLocation, setValidate, userFileChooser, userFileChooser, writeXML, xmlDir
-
Field Details
-
versions
boolean[] versions -
_mfg
-
_mfgID
-
_model
-
_family
-
_filename
-
_productID
-
_replacementModel
-
_replacementFamily
-
_developerID
-
_manufacturerID
-
_programmingModes
-
_numFns
int _numFns -
_numOuts
int _numOuts -
_element
org.jdom2.Element _element -
protocols
-
nextCvStoreIndex
int nextCvStoreIndex -
fileLocation
-
-
Constructor Details
-
DecoderFile
public DecoderFile() -
DecoderFile
public DecoderFile(String mfg, String mfgID, String model, String lowVersionID, String highVersionID, String family, String filename, int numFns, int numOuts, org.jdom2.Element decoder) Create a mechanism to manipulate a decoder definition from up to 10 parameters.- Parameters:
mfg- manufacturer namemfgID- manufacturer's NMRA manufacturer number, typically a "CV8" valuemodel- decoder model designationlowVersionID- decoder version low byte, where applicablehighVersionID- decoder version high byte, where applicablefamily- decoder family name, where applicablefilename- filename of decoder XML definitionnumFns- decoder's number of available functionsnumOuts- decoder's number of available function outputsdecoder- Element containing decoder XML definition
-
DecoderFile
public DecoderFile(String mfg, String mfgID, String model, String lowVersionID, String highVersionID, String family, String filename, int numFns, int numOuts, org.jdom2.Element decoder, String replacementModel, String replacementFamily) Create a mechanism to manipulate a decoder definition from up to 12 parameters.- Parameters:
mfg- manufacturer namemfgID- manufacturer's NMRA manufacturer number, typically a "CV8" valuemodel- decoder model designationlowVersionID- decoder version low byte, where applicablehighVersionID- decoder version high byte, where applicablefamily- decoder family name, where applicablefilename- filename of decoder XML definitionnumFns- decoder's number of available functionsnumOuts- decoder's number of available function outputsdecoder- Element containing decoder XML definitionreplacementModel- name of decoder file (which replaces this one?)replacementFamily- name of decoder family (which replaces this one?)
-
DecoderFile
public DecoderFile(String mfg, String mfgID, String model, String lowVersionID, String highVersionID, String family, String filename, String developerID, String manufacturerID, String productID, int numFns, int numOuts, org.jdom2.Element decoder, String replacementModel, String replacementFamily) Create a mechanism to manipulate a decoder definition from up to 15 parameters.- Parameters:
mfg- manufacturer namemfgID- manufacturer's NMRA manufacturer number, typically a "CV8" valuemodel- decoder model designationlowVersionID- decoder version low byte, where applicablehighVersionID- decoder version high byte, where applicablefamily- decoder family name, where applicablefilename- filename of decoder XML definitiondeveloperID- (typically LocoNet SV2) developerID number (8 bits)manufacturerID- manufacturerID number (8 bits)productID- product ID number (16 bits)numFns- decoder's number of available functionsnumOuts- decoder's number of available function outputsdecoder- Element containing decoder XML definitionreplacementModel- name of decoder file (which replaces this one?)replacementFamily- name of decoder family (which replaces this one?)
-
DecoderFile
public DecoderFile(String mfg, String mfgID, String model, String lowVersionID, String highVersionID, String family, String filename, String developerID, String manufacturerID, String productID, int numFns, int numOuts, org.jdom2.Element decoder, String replacementModel, String replacementFamily, String programmingModes) Create a mechanism to manipulate a decoder definition from up to 16 parameters.- Parameters:
mfg- manufacturer namemfgID- manufacturer's NMRA manufacturer number, typically a "CV8" valuemodel- decoder model designationlowVersionID- decoder version low byte, where applicablehighVersionID- decoder version high byte, where applicablefamily- decoder family name, where applicablefilename- filename of decoder XML definitiondeveloperID- (typically LocoNet SV2) developerID number (8 bits)manufacturerID- manufacturerID number (8 bits)productID- product ID number (16 bits)numFns- decoder's number of available functionsnumOuts- decoder's number of available function outputsdecoder- Element containing decoder XML definitionreplacementModel- name of decoder file (which replaces this one?)replacementFamily- name of decoder family (which replaces this one?)programmingModes- a comma-separated list of supported programming modes
-
-
Method Details
-
setOneVersion
-
setVersionRange
-
setVersionRange
-
isVersion
Test for correct decoder version number- Parameters:
i- the version to match- Returns:
- true if decoder version matches i
-
getVersions
return array of versions- Returns:
- array of boolean where each element is true if version matches
-
getVersionsAsString
-
getMfg
-
getMfgID
-
getDeveloperID
Get the (LocoNet SV2) "Developer ID" number.This value is assigned by the device manufacturer and is an 8-bit number.
- Returns:
- the developerID number
-
getManufacturerID
Get the (LocoNet SV2/Uhlenbrock LNCV) "Manufacturer ID" number.This value typically matches the NMRA manufacturer ID number and is an 8-bit number.
- Returns:
- the manufacturer number
-
getModel
-
getFamily
-
getReplacementModel
-
getReplacementFamily
-
getFileName
-
getNumFunctions
-
getNumOutputs
-
getShowable
-
getModelComment
-
getFamilyComment
-
getProductID
Get the "Product ID" value.When applied to LocoNet devices programmed using the LocoNet SV2 or the Uhlenbrock LNCV protocol, this is a 16-bit value, and is used in identifying the decoder definition file that matches an SV2 or LNCV device.
Decoders which do not support SV2 or LNCV programming may use the Product ID value for other purposes.
- Returns:
- the productID number
-
getModelElement
-
getSupportedProtocols
-
getProgrammingModes
Get all specified programming modes a decoder xml supports. This does not include the programming attributes (like ops=false).- Returns:
- a comma separated string of modes as specified in the decoder xml or empty string when none are specified
-
isProgrammingMode
-
getMfgName
-
getProgrammingModes
-
isProductIDok
-
isIncluded
public static boolean isIncluded(org.jdom2.Element e, String productID, String modelID, String familyID, String extraInclude, String extraExclude) - Parameters:
e- XML element with possible "include" and "exclude" attributes to be checkedproductID- the specific ID of the decoder being loaded, to check against include/exclude conditionsmodelID- the model ID of the decoder being loaded, to check against include/exclude conditionsfamilyID- the family ID of the decoder being loaded, to check against include/exclude conditionsextraInclude- additional "include" termsextraExclude- additional "exclude" terms- Returns:
- true if element is included; false otherwise
-
loadVariableModel
Load a VariableTableModel for a given decoder Element, for the purposes of programming.- Parameters:
decoderElement- element which corresponds to the decodervariableModel- resulting VariableTableModel
-
processVariablesElement
public void processVariablesElement(org.jdom2.Element variablesElement, VariableTableModel variableModel, String extraInclude, String extraExclude) -
loadResetModel
-
loadExtraMenuModel
public void loadExtraMenuModel(org.jdom2.Element decoderElement, ArrayList<ExtraMenuTableModel> extraMenuModelList, JLabel progStatus, Programmer mProgrammer) -
titleString
Convert to a canonical text form for ComboBoxes, etc.Must be able to distinguish identical models in different families.
- Returns:
- the title string for the decoder
-
titleString
-