//------------------------------------------------------------------------------
//    module ParaSetList.cpp                                                  //
//                                                                            //
//    type definition and utilities to store and use several parameter sets   //
//    in a single linked list (TStdList).                                     //
//                                                                            //
//    copyright (c) 2001-2003 by Lars Haendel                                 //
//    home: www.newty.de                                                      //
//                                                                            //
//    This program is free software and can be used under the terms of the    //
//    GNU licence. See header file for further information and disclaimer.    //
//                                                                            //
//------------------------------------------------------------------------------


#include "ParaSetList.h"


//----------------------------------------------------------------------------------------------------------------------
// iterates list from the current position and activates skip flag or deletes entries of all parameter sets that
// will probably produce bigger models than the current parameter set
void SkipBigger(TParaSetList*const& sets, const bool& f_Delete/*=false*/)
{
   const TParaSet ref = sets->Get();            // get current set  (note: copy(!) as it will be deleted soon)

   int i=sets->Pos();
   while(i<sets->Size())      // for each following set
   {
      TParaSet& act = sets->Get(i);             // get i'th parameter set

      // if parameters will produce a bigger model
      if(act.Eta<=ref.Eta && act.w_COD>=ref.w_COD && act.p_min<=ref.p_min && act.Prune<=ref.Prune)
         if(f_Delete)
            sets->Del();                        // delete from list
         else
         {
            act.Skip=true;                      // set skip flag
            i++;
         }
      else
         i++;
   }
}