@Test public void getExpressionBlockStmtSupportedExpression() { for (Supplier<Expression> supplier : supportedExpressionSupplier) { Expression expression = supplier.get(); try { ExpressionFunctionUtils.getExpressionBlockStmt("variableName", expression, parseClassOrInterfaceType(Object.class.getName()), DEFAULT_PARAMETERTYPE_MAP); } catch (Exception e) { fail(String.format("Unexpected %s for %s", e, expression.getClass())); } } }
static BlockStmt getExpressionBlockStmt(final String variableName, final Expression expression, final ClassOrInterfaceType returnedType, final LinkedHashMap<String, ClassOrInterfaceType> parameterNameTypeMap) { if (expression instanceof Aggregate) { return getAggregatedExpressionBlockStmt(variableName, (Aggregate) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof Apply) { return getApplyExpressionBlockStmt(variableName, (Apply) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof Constant) { return getConstantExpressionBlockStmt(variableName, (Constant) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof Discretize) { return getDiscretizeExpressionBlockStmt(variableName, (Discretize) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof FieldRef) { if (parameterNameTypeMap.size() == 1) { return getFieldRefExpressionFromCommonDataBlockStmt(variableName, (FieldRef) expression, returnedType, parameterNameTypeMap); } else { return getFieldRefExpressionFromDefineFunctionBlockStmt(variableName, (FieldRef) expression, returnedType, parameterNameTypeMap); } } else if (expression instanceof Lag) { return getLagExpressionBlockStmt(variableName, (Lag) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof MapValues) { return getMapValuesExpressionBlockStmt(variableName, (MapValues) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof NormContinuous) { return getNormContinuousExpressionBlockStmt(variableName, (NormContinuous) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof NormDiscrete) { return getNormDiscreteExpressionBlockStmt(variableName, (NormDiscrete) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof TextIndex) { return getTextIndexExpressionBlockStmt(variableName, (TextIndex) expression, returnedType, parameterNameTypeMap); } else { throw new IllegalArgumentException(String.format("Expression %s not managed", expression.getClass())); } }
ExpressionFunctionUtils { static BlockStmt getExpressionBlockStmt(final String variableName, final Expression expression, final ClassOrInterfaceType returnedType, final LinkedHashMap<String, ClassOrInterfaceType> parameterNameTypeMap) { if (expression instanceof Aggregate) { return getAggregatedExpressionBlockStmt(variableName, (Aggregate) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof Apply) { return getApplyExpressionBlockStmt(variableName, (Apply) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof Constant) { return getConstantExpressionBlockStmt(variableName, (Constant) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof Discretize) { return getDiscretizeExpressionBlockStmt(variableName, (Discretize) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof FieldRef) { if (parameterNameTypeMap.size() == 1) { return getFieldRefExpressionFromCommonDataBlockStmt(variableName, (FieldRef) expression, returnedType, parameterNameTypeMap); } else { return getFieldRefExpressionFromDefineFunctionBlockStmt(variableName, (FieldRef) expression, returnedType, parameterNameTypeMap); } } else if (expression instanceof Lag) { return getLagExpressionBlockStmt(variableName, (Lag) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof MapValues) { return getMapValuesExpressionBlockStmt(variableName, (MapValues) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof NormContinuous) { return getNormContinuousExpressionBlockStmt(variableName, (NormContinuous) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof NormDiscrete) { return getNormDiscreteExpressionBlockStmt(variableName, (NormDiscrete) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof TextIndex) { return getTextIndexExpressionBlockStmt(variableName, (TextIndex) expression, returnedType, parameterNameTypeMap); } else { throw new IllegalArgumentException(String.format("Expression %s not managed", expression.getClass())); } } }
ExpressionFunctionUtils { static BlockStmt getExpressionBlockStmt(final String variableName, final Expression expression, final ClassOrInterfaceType returnedType, final LinkedHashMap<String, ClassOrInterfaceType> parameterNameTypeMap) { if (expression instanceof Aggregate) { return getAggregatedExpressionBlockStmt(variableName, (Aggregate) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof Apply) { return getApplyExpressionBlockStmt(variableName, (Apply) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof Constant) { return getConstantExpressionBlockStmt(variableName, (Constant) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof Discretize) { return getDiscretizeExpressionBlockStmt(variableName, (Discretize) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof FieldRef) { if (parameterNameTypeMap.size() == 1) { return getFieldRefExpressionFromCommonDataBlockStmt(variableName, (FieldRef) expression, returnedType, parameterNameTypeMap); } else { return getFieldRefExpressionFromDefineFunctionBlockStmt(variableName, (FieldRef) expression, returnedType, parameterNameTypeMap); } } else if (expression instanceof Lag) { return getLagExpressionBlockStmt(variableName, (Lag) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof MapValues) { return getMapValuesExpressionBlockStmt(variableName, (MapValues) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof NormContinuous) { return getNormContinuousExpressionBlockStmt(variableName, (NormContinuous) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof NormDiscrete) { return getNormDiscreteExpressionBlockStmt(variableName, (NormDiscrete) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof TextIndex) { return getTextIndexExpressionBlockStmt(variableName, (TextIndex) expression, returnedType, parameterNameTypeMap); } else { throw new IllegalArgumentException(String.format("Expression %s not managed", expression.getClass())); } } private  ExpressionFunctionUtils(); }
ExpressionFunctionUtils { static BlockStmt getExpressionBlockStmt(final String variableName, final Expression expression, final ClassOrInterfaceType returnedType, final LinkedHashMap<String, ClassOrInterfaceType> parameterNameTypeMap) { if (expression instanceof Aggregate) { return getAggregatedExpressionBlockStmt(variableName, (Aggregate) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof Apply) { return getApplyExpressionBlockStmt(variableName, (Apply) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof Constant) { return getConstantExpressionBlockStmt(variableName, (Constant) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof Discretize) { return getDiscretizeExpressionBlockStmt(variableName, (Discretize) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof FieldRef) { if (parameterNameTypeMap.size() == 1) { return getFieldRefExpressionFromCommonDataBlockStmt(variableName, (FieldRef) expression, returnedType, parameterNameTypeMap); } else { return getFieldRefExpressionFromDefineFunctionBlockStmt(variableName, (FieldRef) expression, returnedType, parameterNameTypeMap); } } else if (expression instanceof Lag) { return getLagExpressionBlockStmt(variableName, (Lag) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof MapValues) { return getMapValuesExpressionBlockStmt(variableName, (MapValues) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof NormContinuous) { return getNormContinuousExpressionBlockStmt(variableName, (NormContinuous) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof NormDiscrete) { return getNormDiscreteExpressionBlockStmt(variableName, (NormDiscrete) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof TextIndex) { return getTextIndexExpressionBlockStmt(variableName, (TextIndex) expression, returnedType, parameterNameTypeMap); } else { throw new IllegalArgumentException(String.format("Expression %s not managed", expression.getClass())); } } private  ExpressionFunctionUtils();  }
ExpressionFunctionUtils { static BlockStmt getExpressionBlockStmt(final String variableName, final Expression expression, final ClassOrInterfaceType returnedType, final LinkedHashMap<String, ClassOrInterfaceType> parameterNameTypeMap) { if (expression instanceof Aggregate) { return getAggregatedExpressionBlockStmt(variableName, (Aggregate) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof Apply) { return getApplyExpressionBlockStmt(variableName, (Apply) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof Constant) { return getConstantExpressionBlockStmt(variableName, (Constant) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof Discretize) { return getDiscretizeExpressionBlockStmt(variableName, (Discretize) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof FieldRef) { if (parameterNameTypeMap.size() == 1) { return getFieldRefExpressionFromCommonDataBlockStmt(variableName, (FieldRef) expression, returnedType, parameterNameTypeMap); } else { return getFieldRefExpressionFromDefineFunctionBlockStmt(variableName, (FieldRef) expression, returnedType, parameterNameTypeMap); } } else if (expression instanceof Lag) { return getLagExpressionBlockStmt(variableName, (Lag) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof MapValues) { return getMapValuesExpressionBlockStmt(variableName, (MapValues) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof NormContinuous) { return getNormContinuousExpressionBlockStmt(variableName, (NormContinuous) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof NormDiscrete) { return getNormDiscreteExpressionBlockStmt(variableName, (NormDiscrete) expression, returnedType, parameterNameTypeMap); } else if (expression instanceof TextIndex) { return getTextIndexExpressionBlockStmt(variableName, (TextIndex) expression, returnedType, parameterNameTypeMap); } else { throw new IllegalArgumentException(String.format("Expression %s not managed", expression.getClass())); } } private  ExpressionFunctionUtils();   }