public OperationCallExp createOperationCallExp( OclExpression source, CoreOperation operation, List <object> arguments, CoreClassifier returnType, bool isMarkedPre) { OperationCallExp exp = new OperationCallExpImpl(); exp.setFactory(this); exp.setReferredOperation(operation); exp.setType(returnType); exp.setSource((isMarkedPre ? createAtPreOperation(source) : source)); if (arguments != null) { foreach (OclExpression argument in arguments) { ((OclExpressionImpl)argument).setParentOperation(exp); ((OperationCallExpImpl)exp).addArgument(argument); } } ((OclExpressionImpl)source).setAppliedProperty(exp); return(exp); }
public OperationCallExp createOperationCallExp( CoreClassifier returnType, OclExpression source, String opName, List <object> arguments, bool isMarkedPre) { OperationCallExp exp = new OperationCallExpImpl(); exp.setFactory(this); exp.setName(opName); exp.setType(returnType); exp.setSource((isMarkedPre ? createAtPreOperation(source) : source)); foreach (OclExpression argument in arguments) { ((OclExpressionImpl)argument).setParentOperation(exp); ((OperationCallExpImpl)exp).addArgument(argument); } ((OclExpressionImpl)source).setAppliedProperty(exp); return(exp); }
public void visitOperationCalllExpBegin(OperationCallExp exp) { var operation = exp.getReferredOperation(); if (operation == null) { return; } // get type of operation string operationName = operation.getName(); OperationCallExpImpl operationCall = (OperationCallExpImpl)exp; bool isBasicOperator = operationCall.isBasicOperator(operationName); bool isBooleanOperator = operationCall.isBooleanOperator(operationName); if (isBooleanOperator) { formula += ","; } else if (isBasicOperator) { formula += string.Format(" {0} ", operationName); } }
public void visitOperationCalllExpBeforeBegin(OperationCallExp exp) { var operation = exp.getReferredOperation(); if (operation == null) { return; } // get type of operation string operationName = operation.getName(); OperationCallExpImpl operationCall = (OperationCallExpImpl)exp; bool isBasicOperator = operationCall.isBasicOperator(operationName); bool isBooleanOperator = operationCall.isBooleanOperator(operationName); var source = operationCall.getSource(); // boolean operators or not basic operators (because boolean operator is a basic operator) if (isBooleanOperator || !isBasicOperator) { // set formula name based on operation name string xoperationname = operationName; // map operation name to formula name based on source expression if (source is AssociationEndCallExpImpl || source is IteratorExpImpl) { if (operationName.Equals("size")) { xoperationname = "COUNTIFS"; } else if (operationName.Equals("sum")) { xoperationname = "SUMIFS"; } } else if (source is VariableExpImpl) { formula += string.Format("[{0}]", operationName); } else { if (operationName.Equals("size")) { xoperationname = "COUNTA"; } else if (operationName.Equals("sum")) { xoperationname = "SUM"; } else if (operationName.Equals("toDate")) { xoperationname = ""; // suppress toDate operation } } if (!(source is VariableExpImpl)) { formula += xoperationname.ToUpper(); } } if (!(source is VariableExpImpl)) { formula += "("; } }