use of jmri.Memory in project JMRI by JMRI.
the class DefaultConditional method getMemory.
/**
* for backward compatibility with config files having system names in lower
* case
*/
private static Memory getMemory(String name) {
Memory m = InstanceManager.memoryManagerInstance().getMemory(name);
if (m == null) {
// N11N
String sName = name.toUpperCase().trim();
m = InstanceManager.memoryManagerInstance().getMemory(sName);
}
return m;
}
use of jmri.Memory in project JMRI by JMRI.
the class DefaultConditionalAction method getIndirectBean.
/**
* If this is an indirect reference return the Memory bean
*
*/
private Memory getIndirectBean(String devName) {
if (devName != null && devName.length() > 0 && devName.charAt(0) == '@') {
String memName = devName.substring(1);
Memory m = InstanceManager.memoryManagerInstance().getMemory(memName);
if (m != null) {
_indirectAction = true;
return m;
}
log.error("\"" + devName + "\" invalid indirect memory name in action " + _actionString + " of type " + _type);
} else {
_indirectAction = false;
}
return null;
}
use of jmri.Memory in project JMRI by JMRI.
the class DefaultConditionalAction method getNamedBean.
@Override
public NamedBeanHandle<?> getNamedBean() {
if (_indirectAction) {
Memory m = (Memory) (_namedBean.getBean());
String actionName = (String) m.getValue();
NamedBean bean = getActionBean(actionName);
if (bean != null) {
return nbhm.getNamedBeanHandle(actionName, bean);
} else {
return null;
}
}
return _namedBean;
}
use of jmri.Memory in project JMRI by JMRI.
the class DefaultConditional method getActionString.
private String getActionString(ConditionalAction action) {
String devAction = action.getActionString();
if (devAction != null && devAction.length() > 0 && devAction.charAt(0) == '@') {
String memName = devAction.substring(1);
Memory m = getMemory(memName);
if (m == null) {
log.error(getDisplayName() + " action \"" + action.getDeviceName() + "\" has invalid memory name in actionString - " + action.getActionString());
return "";
}
devAction = (String) m.getValue();
}
return devAction;
}
use of jmri.Memory in project JMRI by JMRI.
the class DefaultConditional method getDeviceName.
private String getDeviceName(ConditionalAction action) {
String devName = action.getDeviceName();
if (devName != null && devName.length() > 0 && devName.charAt(0) == '@') {
String memName = devName.substring(1);
Memory m = getMemory(memName);
if (m == null) {
log.error(getDisplayName() + " invalid memory name in action - " + devName);
return null;
}
devName = (String) m.getValue();
}
return devName;
}
Aggregations