private void addSimpleConditionsFromComplexExpressions(ExpressionItem expressionItem, Collection<BinaryExpression> simpleConditionsExpressionItems) { if (expressionItem instanceof BinaryExpression) { addSimpleConditionsFromExpressionItems(expressionItem, simpleConditionsExpressionItems); } else if (expressionItem instanceof Variable) { Variable variable = (Variable) expressionItem; simpleConditionsExpressionItems.add(new BinaryExpression(variable, new ConstantExpression("null"), OperatorKind.INEQUAL)); } }
private void addSimpleConditionsFromComplexExpressions(String guideId, ExpressionItem expressionItem, GraphNode graphNode) throws InternalErrorException { if (expressionItem instanceof BinaryExpression) { addExpressionNodes(guideId, expressionItem, graphNode); } else if (expressionItem instanceof Variable) { Variable variable = (Variable) expressionItem; BinaryExpression binaryExpression = new BinaryExpression(variable, new ConstantExpression("null"), OperatorKind.INEQUAL); addExpressionToNode(guideId, binaryExpression, graphNode); } }
public AssignmentExpression toAssignmentExpression() throws IllegalStateException { if (archetypeElementRuleLineElement.getValue() == null) { throw new IllegalStateException("No variable set"); } Variable var = new Variable( archetypeElementRuleLineElement.getValue().getValue(), null, null, OpenEHRConst.NULL_FLAVOR_ATTRIBUTE); DvCodedText nullValue = nullValueRuleLineElement.getValue(); if (nullValue == null) { throw new IllegalStateException("No null value set"); } String dataValueStr = nullValue.toString(); LoggerFactory.getLogger(SetElementAttributeActionRuleLine.class).debug("dataValueStr: " + dataValueStr); return new AssignmentExpression( var, new ConstantExpression(dataValueStr)); } }
public static ConstantExpression convertToExpression(DataValue dv) { String dataValueStr = dv.serialise(); dataValueStr = dataValueStr.substring(dataValueStr.indexOf(",") + 1); if (dv instanceof DvCodedText) { DvCodedText dvCT = (DvCodedText) dv; return new CodedTextConstant(dvCT.getValue(), dvCT.getDefiningCode()); } else if (dv instanceof DvOrdinal) { DvOrdinal dvOrdinal = (DvOrdinal) dv; return new OrdinalConstant(dvOrdinal); } else if (dv instanceof DvText) { return new StringConstant(dataValueStr); } else if (dv instanceof DvDateTime) { return new DateTimeConstant(getDateTimeStrWithoutMillisAndTimezone(dataValueStr)); } else if (dv instanceof DvQuantity) { return new QuantityConstant((DvQuantity) dv); } else if (dv instanceof DvCount) { if (dataValueStr.trim().startsWith("-")) { dataValueStr = "(" + dataValueStr + ")"; } return new ConstantExpression(dataValueStr); } else { return new ConstantExpression(dataValueStr); } }
public ExpressionItem toExpressionItem() throws IllegalStateException { ArchetypeElementVO archetypeElementVO = getArchetypeElement(); if (archetypeElementVO != null) { String path = archetypeElementVO.getPath(); OperatorKind operatorKind = getExistenceOperatorRuleLineElement().getOperator(); if (operatorKind == null) { throw new IllegalStateException("No operator set"); } String name = getArchetypeManager().getArchetypeElements().getText(archetypeElementVO, getLanguage()); return new BinaryExpression( new Variable(null, name, path), new ConstantExpression(NULL_STR), operatorKind); } else { throw new IllegalStateException("Element instance not found for" + this.toString()); } }
public ExpressionItem toExpressionItem() throws IllegalStateException { ArchetypeElementVO archetypeElementVO = getArchetypeElementRuleLineElement().getArchetypeElementVO(); if (archetypeElementVO != null) { String gtCode = getArchetypeElementRuleLineElement().getValue().getValue(); OperatorKind operatorKind = getExistenceOperatorRuleLineElement().getOperator(); if (operatorKind == null) { log.debug("No operator set"); return null; } String name = getArchetypeManager().getArchetypeElements().getText(archetypeElementVO, getLanguage()); return new BinaryExpression( new Variable(gtCode, null, name), new ConstantExpression(NULL_STR), operatorKind); } else { log.debug("Element instance not found for" + this.toString()); return null; } } }
archetypeElementVO.getPath(), OpenEHRConst.NULL_FLAVOR_ATTRIBUTE), new ConstantExpression(dataValueStr), operatorKind); } else {
{if (true) return new ConstantExpression(t.image);} throw new Error("Missing return statement in function");