use of jmri.jmrix.acela.AcelaSignalHead in project JMRI by JMRI.
the class AcelaSignalHeadXml method store.
/**
* Default implementation for storing the contents of a Acela
* AcelaSignalHead
*
* @param o Object to store, of type AcelaSignalHead
* @return Element containing the complete info
*/
@Override
public Element store(Object o) {
AcelaSignalHead p = (AcelaSignalHead) o;
Element element = new Element("signalhead");
element.setAttribute("class", this.getClass().getName());
// include contents
element.setAttribute("systemName", p.getSystemName());
String tu;
tu = p.getUserName();
if (tu != null) {
element.setAttribute("userName", tu);
}
AcelaNode sh = AcelaAddress.getNodeFromSystemName(p.getSystemName(), _memo);
int rawaddr = AcelaAddress.getBitFromSystemName(p.getSystemName());
String shtype = sh.getOutputSignalHeadTypeString(rawaddr);
element.setAttribute("signalheadType", shtype);
storeCommon(p, element);
return element;
}
use of jmri.jmrix.acela.AcelaSignalHead in project JMRI by JMRI.
the class AcelaSignalHeadXml method load.
@Override
public boolean load(Element shared, Element perNode) {
String sys = shared.getAttribute("systemName").getValue();
Attribute a = shared.getAttribute("userName");
SignalHead h;
if (a == null) {
h = new AcelaSignalHead(sys, _memo);
} else {
h = new AcelaSignalHead(sys, a.getValue(), _memo);
}
Attribute t = shared.getAttribute("signalheadType");
String shtype;
if (t == null) {
shtype = "UKNOWN";
} else {
shtype = t.getValue();
}
loadCommon(h, shared);
InstanceManager.getDefault(jmri.SignalHeadManager.class).register(h);
AcelaNode sh = AcelaAddress.getNodeFromSystemName(sys, _memo);
int rawaddr = AcelaAddress.getBitFromSystemName(sys);
sh.setOutputSignalHeadTypeString(rawaddr, shtype);
return true;
}
Aggregations