/**
   * 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(
      ExampleSet exampleSet, String name, ExpressionType expressionType) {

    AttributeMetaData newAttribute = null;
    Attribute existingAtt = exampleSet.getAttributes().get(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(exampleSet.getAttributes().getRole(existingAtt).getSpecialName());
    }

    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;
  }
 /**
  * Subclasses might override this method to define the meta data transformation performed by this
  * operator. The default implementation takes all attributes specified by the {@link
  * AttributeSubsetSelector} and passes them to {@link #modifyAttributeMetaData(ExampleSetMetaData,
  * AttributeMetaData)} and replaces them accordingly.
  *
  * @throws UndefinedParameterError
  */
 @Override
 protected ExampleSetMetaData modifyMetaData(ExampleSetMetaData exampleSetMetaData)
     throws UndefinedParameterError {
   ExampleSetMetaData subsetMetaData =
       attributeSelector.getMetaDataSubset(exampleSetMetaData, isSupportingAttributeRoles());
   checkSelectedSubsetMetaData(subsetMetaData);
   for (AttributeMetaData amd : subsetMetaData.getAllAttributes()) {
     Collection<AttributeMetaData> replacement = null;
     replacement = modifyAttributeMetaData(exampleSetMetaData, amd);
     if (replacement != null) {
       if (replacement.size() == 1) {
         AttributeMetaData replacementAttribute = replacement.iterator().next();
         replacementAttribute.setRole(
             exampleSetMetaData.getAttributeByName(amd.getName()).getRole());
       }
       exampleSetMetaData.removeAttribute(amd);
       exampleSetMetaData.addAllAttributes(replacement);
     }
   }
   return exampleSetMetaData;
 }