/** * Method to create a new Light based on the system name Returns null if the system name is not in * a valid format or if the system name does not correspond to a configured C/MRI digital output * bit Assumes calling method has checked that a Light with this system name does not already * exist */ public Light createNewLight(String systemName, String userName) { Light lgt = null; // Validate the systemName if (SerialAddress.validSystemNameFormat(systemName, 'L')) { lgt = new SerialLight(systemName, userName); if (!SerialAddress.validSystemNameConfig(systemName, 'L')) { log.warn("Light system Name does not refer to configured hardware: " + systemName); } } else { log.error("Invalid Light system Name format: " + systemName); } return lgt; }
/** * Public method to validate system name format returns 'true' if system name has a valid format, * else returns 'false' */ public boolean validSystemNameFormat(String systemName) { return (SerialAddress.validSystemNameFormat(systemName, 'L')); }