def readLogic(logicElement, thresholdMap): if logicElement.tag == 'InternalTrigger': return Lvl1InternalTrigger(logicElement.get('name')) if logicElement.tag == 'TriggerCondition': thr = thresholdMap[logicElement.get('triggerthreshold')] return ThrCondition(thr, int(logicElement.get('multi'))) L = Logic() if logicElement.tag == 'AND': L.logic = Logic.AND elif logicElement.tag == 'OR': L.logic = Logic.OR elif logicElement.tag == 'NOT': L.logic = Logic.NOT else: raise RuntimeError("ERROR: don't understand tag %s" % logicElement.tag) for c in logicElement.getchildren(): L.subConditions += [readLogic(c, thresholdMap)] return L