Package jmri.jmrit.symbolicprog
Class NameFile
- java.lang.Object
- 
- jmri.jmrit.XmlFile
- 
- jmri.jmrit.symbolicprog.NameFile
 
 
- 
 public class NameFile extends XmlFile 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 SummaryNested Classes Modifier and Type Class Description static classNameFile.Initializer- 
Nested classes/interfaces inherited from class jmri.jmrit.XmlFileXmlFile.Validate
 
- 
 - 
Field SummaryFields Modifier and Type Field Description protected java.util.HashMap<java.lang.String,org.jdom2.Element>_nameHash(package private) static java.lang.StringfileLocation(package private) static java.lang.StringnameFileName- 
Fields inherited from class jmri.jmrit.XmlFiledtdLocation, xsltLocation
 
- 
 - 
Constructor SummaryConstructors Constructor Description NameFile()
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckName(java.lang.String name)Check to see if a name is present in the file.protected static java.lang.StringdefaultNameFilename()Get the filename for the default file, including location.org.jdom2.ElementelementFromName(java.lang.String name)java.util.Set<java.lang.String>names()(package private) voidreadFile(java.lang.String name)Read 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.XmlFileaddDefaultInfo, 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 Detail- 
_nameHashprotected java.util.HashMap<java.lang.String,org.jdom2.Element> _nameHash 
 - 
fileLocationstatic java.lang.String fileLocation 
 - 
nameFileNamestatic java.lang.String nameFileName 
 
- 
 - 
Constructor Detail- 
NameFilepublic NameFile() 
 
- 
 - 
Method Detail- 
namespublic java.util.Set<java.lang.String> names() 
 - 
elementFromNamepublic org.jdom2.Element elementFromName(java.lang.String name) 
 - 
checkNamepublic boolean checkName(java.lang.String name) Check to see if a name is present in the file.- Parameters:
- name- the name to check
- Returns:
- true if present; false otherwise
 
 - 
readFilevoid readFile(java.lang.String name) throws org.jdom2.JDOMException, java.io.IOException 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 parsed
- java.io.IOException- from underlying IO operations
 
 - 
readNamesvoid readNames(org.jdom2.Element root) 
 - 
storeDefinitionvoid storeDefinition(org.jdom2.Element el) 
 - 
defaultNameFilenameprotected static java.lang.String defaultNameFilename() Get the filename for the default file, including location. This is here to allow easy override in tests.- Returns:
- the default filename
 
 
- 
 
-