Bug #4030

Fix GGti insert() and merge() methods

Added by Knödlseder Jürgen about 2 years ago. Updated about 2 years ago.

Status:ClosedStart date:04/14/2022
Priority:ImmediateDue date:
Assigned To:Knödlseder Jürgen% Done:

100%

Category:-
Target version:2.0.0
Duration:

Description

The GGti::insert does not insert correctly the time interval in the already existing intervals, and the GGti::merge method does not update the attributes correctly.


Recurrence

No recurrence.

History

#1 Updated by Knödlseder Jürgen about 2 years ago

  • % Done changed from 0 to 10

I changed the code from

void GGti::insert(const GTime& tstart, const GTime& tstop)
{
    // Determine index at which GTI should be inserted
    int inx = 0;
    for (int i = 0; i < m_num; ++i) {
        if (tstart < m_start[i]) {
            break;
        }
    }

    // Insert interval
    insert_gti(inx, tstart, tstop);

    // Return
    return;
}
to
void GGti::insert(const GTime& tstart, const GTime& tstop)
{
    // Determine index at which GTI should be inserted
    int inx = 0;
    for (; inx < m_num; ++inx) {
        if (tstart < m_start[inx]) {
            break;
        }
    }

    // Insert interval
    insert_gti(inx, tstart, tstop);

    // Return
    return;
}
so that inx is indeed set to the correct index. Before, inx was always zero.

#2 Updated by Knödlseder Jürgen about 2 years ago

  • % Done changed from 10 to 20

I added

    // Update attributes
    set_attributes();
at the end of the GGti::merge method so that attributes get correctly updated.

#3 Updated by Knödlseder Jürgen about 2 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 20 to 100

Merged into devel.

Also available in: Atom PDF