Package jmri.jmrit.symbolicprog
Class NameFile
java.lang.Object
jmri.jmrit.XmlFile
jmri.jmrit.symbolicprog.NameFile
Represents a set of standard names and aliases in memory.
This class doesn't provide tools for defining the names and aliases; that's done manually, or at least not done here, to create the file.
This automatically initializes from the default file if requested from the InstanceManager.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class jmri.jmrit.XmlFile
XmlFile.Validate -
Field Summary
FieldsFields inherited from class jmri.jmrit.XmlFile
dtdLocation, xsltLocation -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanCheck to see if a name is present in the file.protected static StringGet the filename for the default file, including location.org.jdom2.ElementelementFromName(String name) names()(package private) voidRead the contents of a NameFile XML file into this object.(package private) voidreadNames(org.jdom2.Element root) (package private) voidstoreDefinition(org.jdom2.Element el) 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
-
_nameHash
-
fileLocation
-
nameFileName
-
-
Constructor Details
-
NameFile
public NameFile()
-
-
Method Details
-
names
-
elementFromName
-
checkName
Check to see if a name is present in the file.- Parameters:
name- the name to check- Returns:
- true if present; false otherwise
-
readFile
Read the contents of a NameFile XML file into this object. Note that this does not clear any existing entries.- Parameters:
name- File name to read- Throws:
org.jdom2.JDOMException- if the file can't be parsedIOException- from underlying IO operations
-
readNames
-
storeDefinition
-
defaultNameFilename
Get the filename for the default file, including location. This is here to allow easy override in tests.- Returns:
- the default filename
-