Package jmri.jmrix.nce.consist
Class NceConsistRosterEntry
- java.lang.Object
-
- jmri.jmrix.nce.consist.NceConsistRosterEntry
-
public class NceConsistRosterEntry extends java.lang.Object
ConsistRosterEntry represents a single element in a consist roster.The ConsistRosterEntry is the central place to find information about a consists configuration, including loco address, address type, loco's direction, and consist number. Up to six consist locos are currently tracked. ConsistRosterEntry handles persistency through the LocoFile class. Creating a ConsistRosterEntry does not necessarily read the corresponding file (which might not even exist), please see readFile(), writeFile() member functions.
All the data attributes have a content, not null.
When the filePath attribute is non-null, the user has decided to organize the roster into directories.
- See Also:
NceConsistRoster
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
_comment
protected java.lang.String
_consistNumber
protected java.lang.String
_fileName
protected java.lang.String
_id
protected boolean
_isLoco1LongAddress
protected boolean
_isLoco2LongAddress
protected boolean
_isLoco3LongAddress
protected boolean
_isLoco4LongAddress
protected boolean
_isLoco5LongAddress
protected boolean
_isLoco6LongAddress
protected java.lang.String
_loco1DccAddress
protected java.lang.String
_loco1Direction
protected java.lang.String
_loco2DccAddress
protected java.lang.String
_loco2Direction
protected java.lang.String
_loco3DccAddress
protected java.lang.String
_loco3Direction
protected java.lang.String
_loco4DccAddress
protected java.lang.String
_loco4Direction
protected java.lang.String
_loco5DccAddress
protected java.lang.String
_loco5Direction
protected java.lang.String
_loco6DccAddress
protected java.lang.String
_loco6Direction
protected java.lang.String
_model
protected java.lang.String
_roadName
protected java.lang.String
_roadNumber
-
Constructor Summary
Constructors Constructor Description NceConsistRosterEntry()
Construct a blank object.NceConsistRosterEntry(NceConsistRosterEntry pEntry, java.lang.String pID)
NceConsistRosterEntry(org.jdom2.Element e)
Construct this Entry from XML.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getComment()
java.lang.String
getConsistNumber()
java.lang.String
getId()
java.lang.String
getLoco1DccAddress()
java.lang.String
getLoco1Direction()
java.lang.String
getLoco2DccAddress()
java.lang.String
getLoco2Direction()
java.lang.String
getLoco3DccAddress()
java.lang.String
getLoco3Direction()
java.lang.String
getLoco4DccAddress()
java.lang.String
getLoco4Direction()
java.lang.String
getLoco5DccAddress()
java.lang.String
getLoco5Direction()
java.lang.String
getLoco6DccAddress()
java.lang.String
getLoco6Direction()
java.lang.String
getModel()
java.lang.String
getRoadName()
java.lang.String
getRoadNumber()
boolean
isLoco1LongAddress()
boolean
isLoco2LongAddress()
boolean
isLoco3LongAddress()
boolean
isLoco4LongAddress()
boolean
isLoco5LongAddress()
boolean
isLoco6LongAddress()
void
printEntry(java.io.Writer w)
Prints the roster information.void
setComment(java.lang.String s)
void
setConsistNumber(java.lang.String s)
void
setId(java.lang.String s)
void
setLoco1DccAddress(java.lang.String s)
void
setLoco1Direction(java.lang.String s)
void
setLoco1LongAddress(boolean b)
void
setLoco2DccAddress(java.lang.String s)
void
setLoco2Direction(java.lang.String s)
void
setLoco2LongAddress(boolean b)
void
setLoco3DccAddress(java.lang.String s)
void
setLoco3Direction(java.lang.String s)
void
setLoco3LongAddress(boolean b)
void
setLoco4DccAddress(java.lang.String s)
void
setLoco4Direction(java.lang.String s)
void
setLoco4LongAddress(boolean b)
void
setLoco5DccAddress(java.lang.String s)
void
setLoco5Direction(java.lang.String s)
void
setLoco5LongAddress(boolean b)
void
setLoco6DccAddress(java.lang.String s)
void
setLoco6Direction(java.lang.String s)
void
setLoco6LongAddress(boolean b)
void
setModel(java.lang.String s)
void
setRoadName(java.lang.String s)
void
setRoadNumber(java.lang.String s)
(package private) org.jdom2.Element
store()
Create an XML element to represent this Entry.java.lang.String
titleString()
java.lang.String
toString()
java.util.Vector<java.lang.String>
wrapComment(java.lang.String comment, int textSpace)
Take a String comment field and perform line wrapping on it.
-
-
-
Field Detail
-
_fileName
protected java.lang.String _fileName
-
_id
protected java.lang.String _id
-
_consistNumber
protected java.lang.String _consistNumber
-
_roadName
protected java.lang.String _roadName
-
_roadNumber
protected java.lang.String _roadNumber
-
_model
protected java.lang.String _model
-
_loco1DccAddress
protected java.lang.String _loco1DccAddress
-
_isLoco1LongAddress
protected boolean _isLoco1LongAddress
-
_loco1Direction
protected java.lang.String _loco1Direction
-
_loco2DccAddress
protected java.lang.String _loco2DccAddress
-
_isLoco2LongAddress
protected boolean _isLoco2LongAddress
-
_loco2Direction
protected java.lang.String _loco2Direction
-
_loco3DccAddress
protected java.lang.String _loco3DccAddress
-
_isLoco3LongAddress
protected boolean _isLoco3LongAddress
-
_loco3Direction
protected java.lang.String _loco3Direction
-
_loco4DccAddress
protected java.lang.String _loco4DccAddress
-
_isLoco4LongAddress
protected boolean _isLoco4LongAddress
-
_loco4Direction
protected java.lang.String _loco4Direction
-
_loco5DccAddress
protected java.lang.String _loco5DccAddress
-
_isLoco5LongAddress
protected boolean _isLoco5LongAddress
-
_loco5Direction
protected java.lang.String _loco5Direction
-
_loco6DccAddress
protected java.lang.String _loco6DccAddress
-
_isLoco6LongAddress
protected boolean _isLoco6LongAddress
-
_loco6Direction
protected java.lang.String _loco6Direction
-
_comment
protected java.lang.String _comment
-
-
Constructor Detail
-
NceConsistRosterEntry
public NceConsistRosterEntry()
Construct a blank object.
-
NceConsistRosterEntry
public NceConsistRosterEntry(NceConsistRosterEntry pEntry, java.lang.String pID)
-
NceConsistRosterEntry
public NceConsistRosterEntry(org.jdom2.Element e)
Construct this Entry from XML. This member has to remain synchronized with the detailed DTD in xml/DTD/consist-roster-config.dtd.- Parameters:
e
- Consist XML element
-
-
Method Detail
-
setId
public void setId(java.lang.String s)
-
getId
public java.lang.String getId()
-
setConsistNumber
public void setConsistNumber(java.lang.String s)
-
getConsistNumber
public java.lang.String getConsistNumber()
-
setRoadName
public void setRoadName(java.lang.String s)
-
getRoadName
public java.lang.String getRoadName()
-
setRoadNumber
public void setRoadNumber(java.lang.String s)
-
getRoadNumber
public java.lang.String getRoadNumber()
-
setModel
public void setModel(java.lang.String s)
-
getModel
public java.lang.String getModel()
-
setLoco1DccAddress
public void setLoco1DccAddress(java.lang.String s)
-
getLoco1DccAddress
public java.lang.String getLoco1DccAddress()
-
setLoco1LongAddress
public void setLoco1LongAddress(boolean b)
-
isLoco1LongAddress
public boolean isLoco1LongAddress()
-
setLoco1Direction
public void setLoco1Direction(java.lang.String s)
-
getLoco1Direction
public java.lang.String getLoco1Direction()
-
setLoco2DccAddress
public void setLoco2DccAddress(java.lang.String s)
-
getLoco2DccAddress
public java.lang.String getLoco2DccAddress()
-
setLoco2LongAddress
public void setLoco2LongAddress(boolean b)
-
isLoco2LongAddress
public boolean isLoco2LongAddress()
-
setLoco2Direction
public void setLoco2Direction(java.lang.String s)
-
getLoco2Direction
public java.lang.String getLoco2Direction()
-
setLoco3DccAddress
public void setLoco3DccAddress(java.lang.String s)
-
getLoco3DccAddress
public java.lang.String getLoco3DccAddress()
-
setLoco3LongAddress
public void setLoco3LongAddress(boolean b)
-
isLoco3LongAddress
public boolean isLoco3LongAddress()
-
setLoco3Direction
public void setLoco3Direction(java.lang.String s)
-
getLoco3Direction
public java.lang.String getLoco3Direction()
-
setLoco4DccAddress
public void setLoco4DccAddress(java.lang.String s)
-
getLoco4DccAddress
public java.lang.String getLoco4DccAddress()
-
setLoco4LongAddress
public void setLoco4LongAddress(boolean b)
-
isLoco4LongAddress
public boolean isLoco4LongAddress()
-
setLoco4Direction
public void setLoco4Direction(java.lang.String s)
-
getLoco4Direction
public java.lang.String getLoco4Direction()
-
setLoco5DccAddress
public void setLoco5DccAddress(java.lang.String s)
-
getLoco5DccAddress
public java.lang.String getLoco5DccAddress()
-
setLoco5LongAddress
public void setLoco5LongAddress(boolean b)
-
isLoco5LongAddress
public boolean isLoco5LongAddress()
-
setLoco5Direction
public void setLoco5Direction(java.lang.String s)
-
getLoco5Direction
public java.lang.String getLoco5Direction()
-
setLoco6DccAddress
public void setLoco6DccAddress(java.lang.String s)
-
getLoco6DccAddress
public java.lang.String getLoco6DccAddress()
-
setLoco6LongAddress
public void setLoco6LongAddress(boolean b)
-
isLoco6LongAddress
public boolean isLoco6LongAddress()
-
setLoco6Direction
public void setLoco6Direction(java.lang.String s)
-
getLoco6Direction
public java.lang.String getLoco6Direction()
-
setComment
public void setComment(java.lang.String s)
-
getComment
public java.lang.String getComment()
-
store
org.jdom2.Element store()
Create an XML element to represent this Entry. This member has to remain synchronized with the detailed DTD in xml/DTD/consist-roster-config.dtd.- Returns:
- Contents in a JDOM Element
-
titleString
public java.lang.String titleString()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
printEntry
public void printEntry(java.io.Writer w)
Prints the roster information. Updated to allow for multiline comment field. Created separate write statements for text and line feeds to work around the HardcopyWriter bug that misplaces borders.- Parameters:
w
- stream to printer
-
wrapComment
public java.util.Vector<java.lang.String> wrapComment(java.lang.String comment, int textSpace)
Take a String comment field and perform line wrapping on it. String must be non-null and may or may not have \n characters embedded. textSpace is the width of the space to print for wrapping purposes. The comment is wrapped on a word wrap basis This is exactly the same as RosterEntry.wrapComment- Parameters:
comment
- string comment from consist roster entrytextSpace
- size of space to wrap text into- Returns:
- wrap formated comment
-
-