public Instances stringFreeStructure(){
  ArrayList<Attribute> newAtts=new ArrayList<Attribute>();
  for (  Attribute att : m_Attributes) {
    if (att.type() == Attribute.STRING) {
      newAtts.add(new Attribute(att.name(),(List<String>)null,att.index()));
    }
 else     if (att.type() == Attribute.RELATIONAL) {
      newAtts.add(new Attribute(att.name(),new Instances(att.relation(),0),att.index()));
    }
  }
  if (newAtts.size() == 0) {
    return new Instances(this,0);
  }
  ArrayList<Attribute> atts=Utils.cast(m_Attributes.clone());
  for (  Attribute att : newAtts) {
    atts.set(att.index(),att);
  }
  Instances result=new Instances(this,0);
  result.m_Attributes=atts;
  return result;
}

public Instances stringFreeStructure ( ) { ArrayList < Attribute > newAtts = new ArrayList < Attribute > ( ) ; for ( Attribute att : m_Attributes ) { if ( att . type ( ) == Attribute . STRING ) { newAtts . add ( new Attribute ( att . name ( ) , ( List < String > ) null , att . index ( ) ) ) ; } else if ( att . type ( ) == Attribute . RELATIONAL ) { newAtts . add ( new Attribute ( att . name ( ) , new Instances ( att . relation ( ) , 0 ) , att . index ( ) ) ) ; } } if ( newAtts . size ( ) == 0 ) { return new Instances ( this , 0 ) ; } ArrayList < Attribute > atts = Utils . cast ( m_Attributes . clone ( ) ) ; for ( Attribute att : newAtts ) { atts . set ( att . index ( ) , att ) ; } Instances result = new Instances ( this , 0 ) ; result . m_Attributes = atts ; return result ; }
create a copy of the structure if the data has string or relational attributes , " cleanses " string types ( i . e . doesn ' t contain references to the strings seen in the past ) and all relational attributes .
