Trajectory::RIndex::RIndex(const Trajectory &tr, const Context &c, double t0, double tstart) { done = false; t = t0; startt = tstart; v = tr.Values(c,t0,false); for(ivmap::const_iterator vi = tr.traj.begin(); vi != tr.traj.end(); vi++) { if(!c.HasId(vi->first)) continue; VarTrajectory::const_reverse_iterator i(vi->second.lower_bound(t0)); if (i!=vi->second.rend()) { vari.insert(make_pair(vi->first,make_pair(i,vi->second.rend()))); if (i->first>startt) nextvar.push(make_pair(i->first,vi->first)); } } }
Trajectory::Index::Index(const Trajectory &tr, const Context &c, double t0, double tend) { done = false; t = t0; endt = tend; v = tr.Values(c,t0); for(ivmap::const_iterator vi = tr.traj.begin(); vi != tr.traj.end(); vi++) { if(!c.HasId(vi->first)) continue; VarTrajectory::const_iterator i = vi->second.upper_bound(t0); if (i!=vi->second.end()) { vari.insert(make_pair(vi->first,make_pair(i,vi->second.end()))); if (i->first<endt) nextvar.push(make_pair(-i->first,vi->first)); } } }