public FeatureDefinition subset(String[] featureNamesToDrop){
  List<Integer> featureIndicesToDrop=new ArrayList<Integer>();
  for (  String featureName : featureNamesToDrop) {
    int featureIndex;
    try {
      featureIndex=getFeatureIndex(featureName);
      featureIndicesToDrop.add(featureIndex);
    }
 catch (    IllegalArgumentException e) {
      System.err.println("WARNING: feature " + featureName + " not found in FeatureDefinition; ignoring.");
    }
  }
  FeatureDefinition subDefinition=null;
  try {
    ByteArrayOutputStream toMemory=new ByteArrayOutputStream();
    DataOutput output=new DataOutputStream(toMemory);
    writeBinaryTo(output,featureIndicesToDrop);
    byte[] memory=toMemory.toByteArray();
    ByteArrayInputStream fromMemory=new ByteArrayInputStream(memory);
    DataInput input=new DataInputStream(fromMemory);
    subDefinition=new FeatureDefinition(input);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  assert this.contains(subDefinition);
  return subDefinition;
}

public FeatureDefinition subset ( String [ ] featureNamesToDrop ) { List < Integer > featureIndicesToDrop = new ArrayList < Integer > ( ) ; for ( String featureName : featureNamesToDrop ) { int featureIndex ; try { featureIndex = getFeatureIndex ( featureName ) ; featureIndicesToDrop . add ( featureIndex ) ; } catch ( IllegalArgumentException e ) { System . err . println ( "WARNING: feature " + featureName + " not found in FeatureDefinition; ignoring." ) ; } } FeatureDefinition subDefinition = null ; try { ByteArrayOutputStream toMemory = new ByteArrayOutputStream ( ) ; DataOutput output = new DataOutputStream ( toMemory ) ; writeBinaryTo ( output , featureIndicesToDrop ) ; byte [ ] memory = toMemory . toByteArray ( ) ; ByteArrayInputStream fromMemory = new ByteArrayInputStream ( memory ) ; DataInput input = new DataInputStream ( fromMemory ) ; subDefinition = new FeatureDefinition ( input ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } assert this . contains ( subDefinition ) ; return subDefinition ; }
create a new featuredefinition that contains a subset of the features in this .
