308 const int last = obs.size()-1;
309 if (obs.size()<2 || obs[last].duration()>=40./24/60 || obs[last].name==
"SLEEP" || obs[last-1].name==
"SLEEP")
312 cout <<
"Last source [" << obs[last].name <<
"] detected < 40min" << endl;
314 const double obs1_duration = obs[last].end - 40./24/60 - obs[last-1].begin;
315 const double obs0_begin = obs[last].end - 40./24/60;
322 if (obs1_duration>=40./24/60 && obs[last].IsRangeValid(obs0_begin, obs[last].
begin))
324 obs[last].begin = obs0_begin;
325 obs[last-1].end = obs0_begin;
327 cout <<
"Last source [" << obs[last].name <<
"] extended to 40min" << endl;
333 if (obs[last-1].IsRangeValid(obs[last].begin, obs[last].
end))
335 cout <<
"Last source [" << obs[last].name <<
"] removed" << endl;
337 obs[last-1].end = obs[last].end;
344 if (obs[last].IsRangeValid(obs[last-1].begin, obs[last-1].end))
346 cout <<
"Second last source [" << obs[last-1].name <<
"] removed" << endl;
348 obs[last].begin = obs[last-1].begin;
349 obs.erase(obs.begin()+obs.size()-2);
351 if (obs.size()==0 || obs[last-1].name!=obs[last-2].name)
354 obs[last-2].end = obs[last-1].end;
357 cout <<
"Combined last two indentical sources [" << obs[last-1].name <<
"] into one observation" << endl;
362 cout <<
"No reschedule possible within limit." << endl;