@Override public AssignmentStatement transform(Operator operator) { EObject operatorInput = getInputObject(operator); EObject operatorOutput = getOutputObject(operator); if (operatorInput instanceof Element && operatorOutput instanceof Element) { Element inputElement = (Element) operatorInput; return getSimpleOperatorMapping(operator, inputElement); } else if (operatorInput instanceof Element && operatorOutput instanceof OperatorLeftConnector) { Operator nextOperator = (Operator) getOperator(operatorOutput); // create ___ = me ____ and pass String subAssign = createSubAssignment((Element) operatorInput); OperatorsTransformer transformer = DataMapperTransformerRegistry.getInstance().getTransformer(nextOperator); String assign = transformer.trasnform(subAssign, operator, nextOperator); AssignmentStatement statement = new AssignmentStatement(); statement.setStatement(assign); return statement; } return null; }
@Override public String trasnform(String subStatement, Operator previousOperator, Operator operator) { EObject operatorOutput = getOutputObject(operator); StringBuilder builder = new StringBuilder(); builder.append(subStatement); if (operatorOutput instanceof Element) { // fill the blank Element outputElement = (Element) operatorOutput; builder.insert(0, outputElement.getFieldParent().getName() + "." + outputElement.getName()); builder.append(getOperatorFunction()).append(";"); return builder.toString(); } else if (operatorOutput instanceof OperatorLeftConnector) { Operator nextOperator = (Operator) getOperator(operatorOutput); builder.append(getOperatorFunction()); OperatorsTransformer transformer = DataMapperTransformerRegistry.getInstance().getTransformer(nextOperator); String assign = transformer.trasnform(builder.toString(), operator, nextOperator); return assign; } return null; }