@Override
  public boolean addDynamicSourceCode(DynamicSourceCodeBuilder<T> builder, String variableName) {
    String condition1 = builder.addFeatureVariable(condition, "condition");

    builder.append("if (" + condition1 + "!=null) {");
    builder.indent();
    builder.append("if (" + condition1 + ") {");
    builder.indent();
    String thenResult = builder.addFeatureVariable(thenFeature, "then");
    builder.append("if (" + thenResult + "!=null) " + variableName + " = " + thenResult + ";");
    builder.outdent();
    builder.append("} else {");
    builder.indent();
    String elseResult = builder.addFeatureVariable(elseFeature, "else");
    builder.append("if (" + elseResult + "!=null) " + variableName + " = " + elseResult + ";");
    builder.outdent();
    builder.append("}");
    builder.outdent();
    builder.append("}");

    return true;
  }
예제 #2
0
  @Override
  public boolean addDynamicSourceCode(DynamicSourceCodeBuilder<T> builder, String variableName) {
    String operand1Name = builder.addFeatureVariable(operand1, "operand");
    String operand2Name = builder.addFeatureVariable(operand2, "operand");

    builder.append("if (" + operand1Name + "!=null && " + operand2Name + "!=null) {");
    builder.indent();
    builder.append(variableName + "=" + operand1Name + ">" + operand2Name + ";");
    builder.outdent();
    builder.append("}");

    return true;
  }