public void sort(int attIndex){
  double[] vals=new double[numInstances()];
  Instance[] backup=new Instance[vals.length];
  for (int i=0; i < vals.length; i++) {
    Instance inst=instance(i);
    backup[i]=inst;
    double val=inst.value(attIndex);
    if (Utils.isMissingValue(val)) {
      vals[i]=Double.MAX_VALUE;
    }
 else {
      vals[i]=val;
    }
  }
  int[] sortOrder=Utils.sortWithNoMissingValues(vals);
  for (int i=0; i < vals.length; i++) {
    m_Instances.set(i,backup[sortOrder[i]]);
  }
}

public void sort ( int attIndex ) { double [ ] vals = new double [ numInstances ( ) ] ; Instance [ ] backup = new Instance [ vals . length ] ; for ( int i = 0 ; i < vals . length ; i ++ ) { Instance inst = instance ( i ) ; backup [ i ] = inst ; double val = inst . value ( attIndex ) ; if ( Utils . isMissingValue ( val ) ) { vals [ i ] = Double . MAX_VALUE ; } else { vals [ i ] = val ; } } int [ ] sortOrder = Utils . sortWithNoMissingValues ( vals ) ; for ( int i = 0 ; i < vals . length ; i ++ ) { m_Instances . set ( i , backup [ sortOrder [ i ] ] ) ; } }
sorts the instances based on an attribute . for numeric attributes , instances are sorted in ascending order . for nominal attributes , instances are sorted based on the attribute label ordering specified in the header . instances with missing values for the attribute are placed at the end of the dataset .
