private List<WeightedObservedPoint> sortObservations(Collection<WeightedObservedPoint> unsorted){
  final List<WeightedObservedPoint> observations=new ArrayList<WeightedObservedPoint>(unsorted);
  WeightedObservedPoint curr=observations.get(0);
  final int len=observations.size();
  for (int j=1; j < len; j++) {
    WeightedObservedPoint prec=curr;
    curr=observations.get(j);
    if (curr.getX() < prec.getX()) {
      int i=j - 1;
      WeightedObservedPoint mI=observations.get(i);
      while ((i >= 0) && (curr.getX() < mI.getX())) {
        observations.set(i + 1,mI);
        if (i-- != 0) {
          mI=observations.get(i);
        }
      }
      observations.set(i + 1,curr);
      curr=observations.get(j);
    }
  }
  return observations;
}

private List < WeightedObservedPoint > sortObservations ( Collection < WeightedObservedPoint > unsorted ) { final List < WeightedObservedPoint > observations = new ArrayList < WeightedObservedPoint > ( unsorted ) ; WeightedObservedPoint curr = observations . get ( 0 ) ; final int len = observations . size ( ) ; for ( int j = 1 ; j < len ; j ++ ) { WeightedObservedPoint prec = curr ; curr = observations . get ( j ) ; if ( curr . getX ( ) < prec . getX ( ) ) { int i = j - 1 ; WeightedObservedPoint mI = observations . get ( i ) ; while ( ( i >= 0 ) && ( curr . getX ( ) < mI . getX ( ) ) ) { observations . set ( i + 1 , mI ) ; if ( i -- != 0 ) { mI = observations . get ( i ) ; } } observations . set ( i + 1 , curr ) ; curr = observations . get ( j ) ; } } return observations ; }
sort the observations with respect to the abscissa .
