/**
   * Creates attribute meta data that represents the attribute that will be generated for the
   * provided arguments.
   *
   * @return the {@link AttributeMetaData} for the provided arguments
   */
  public static AttributeMetaData generateAttributeMetaData(
      ExampleSetMetaData emd, String name, ExpressionType expressionType) {

    AttributeMetaData newAttribute = null;
    AttributeMetaData existingAtt = emd.getAttributeByName(name);

    int ontology = expressionType.getAttributeType();

    if (ontology == Ontology.BINOMINAL) {
      newAttribute = new AttributeMetaData(name, Ontology.BINOMINAL);
      HashSet<String> values = new HashSet<>();
      values.add("false");
      values.add("true");
      newAttribute.setValueSet(values, SetRelation.EQUAL);
    } else {
      newAttribute = new AttributeMetaData(name, ontology);
    }

    // restore role if attribute existed already
    if (existingAtt != null) {
      newAttribute.setRole(existingAtt.getRole());
    }

    return newAttribute;
  }
  @Override
  protected MetaData modifyMetaData(ExampleSetMetaData metaData) {
    try {
      AttributeMetaData amd1 =
          metaData.getAttributeByName(getParameterAsString(PARAMETER_FIRST_ATTRIBUTE));
      AttributeMetaData amd2 =
          metaData.getAttributeByName(getParameterAsString(PARAMETER_SECOND_ATTRIBUTE));

      if (amd1 != null && amd2 != null) {
        String role1 = amd1.getRole();
        amd1.setRole(amd2.getRole());
        amd2.setRole(role1);
      }
    } catch (UndefinedParameterError e) {
    }
    return metaData;
  }
 @Override
 protected Collection<AttributeMetaData> modifyAttributeMetaData(
     ExampleSetMetaData emd, AttributeMetaData amd) throws UndefinedParameterError {
   AttributeMetaData newAMD =
       new AttributeMetaData(amd.getName(), Ontology.NOMINAL, amd.getRole());
   Set<String> valueSet = new TreeSet<String>();
   if (getParameterAsInt(PARAMETER_RANGE_NAME_TYPE) == DiscretizationModel.RANGE_NAME_SHORT) {
     for (int i = 0; i < getParameterAsInt(PARAMETER_NUMBER_OF_BINS); i++) {
       valueSet.add("range" + (i + 1));
     }
     newAMD.setValueSet(valueSet, SetRelation.EQUAL);
   } else {
     newAMD.setValueSet(valueSet, SetRelation.SUPERSET);
   }
   return Collections.singletonList(newAMD);
 }