comparison data/fileio/CSVFormat.cpp @ 1525:a92e94215863

Various CSV format tests
author Chris Cannam
date Fri, 14 Sep 2018 14:47:46 +0100
parents 64ef24ebb19c
children 9570ef94eaa3
comparison
equal deleted inserted replaced
1524:64ef24ebb19c 1525:a92e94215863
247 { 247 {
248 m_timingType = CSVFormat::ImplicitTiming; 248 m_timingType = CSVFormat::ImplicitTiming;
249 m_timeUnits = CSVFormat::TimeWindows; 249 m_timeUnits = CSVFormat::TimeWindows;
250 250
251 int timingColumnCount = 0; 251 int timingColumnCount = 0;
252 bool haveDurationOrEndTime = false;
252 253
253 SVDEBUG << "Estimated column qualities overall: "; 254 SVDEBUG << "Estimated column qualities overall: ";
254 for (int i = 0; i < m_columnCount; ++i) { 255 for (int i = 0; i < m_columnCount; ++i) {
255 SVDEBUG << int(m_columnQualities[i]) << " "; 256 SVDEBUG << int(m_columnQualities[i]) << " ";
256 } 257 }
308 309
309 } else { 310 } else {
310 311
311 if (timingColumnCount == 2 && m_timingType == ExplicitTiming) { 312 if (timingColumnCount == 2 && m_timingType == ExplicitTiming) {
312 purpose = ColumnEndTime; 313 purpose = ColumnEndTime;
314 haveDurationOrEndTime = true;
313 } 315 }
314 } 316 }
315 } 317 }
316 318
317 if (purpose == ColumnUnknown) { 319 if (purpose == ColumnUnknown) {
351 timecol = b; 353 timecol = b;
352 } 354 }
353 if (m_columnQualities[timecol] & ColumnIncreasing) { 355 if (m_columnQualities[timecol] & ColumnIncreasing) {
354 // This shouldn't happen; should have been settled above 356 // This shouldn't happen; should have been settled above
355 m_columnPurposes[timecol] = ColumnEndTime; 357 m_columnPurposes[timecol] = ColumnEndTime;
358 haveDurationOrEndTime = true;
356 } else { 359 } else {
357 m_columnPurposes[timecol] = ColumnDuration; 360 m_columnPurposes[timecol] = ColumnDuration;
361 haveDurationOrEndTime = true;
358 } 362 }
359 --valueCount; 363 --valueCount;
360 } 364 }
361 } 365 }
362 } 366 }
363 367
364 if (timingColumnCount > 1) { 368 if (timingColumnCount > 1 || haveDurationOrEndTime) {
365 m_modelType = TwoDimensionalModelWithDuration; 369 m_modelType = TwoDimensionalModelWithDuration;
366 } else { 370 } else {
367 if (valueCount == 0) { 371 if (valueCount == 0) {
368 m_modelType = OneDimensionalModel; 372 m_modelType = OneDimensionalModel;
369 } else if (valueCount == 1) { 373 } else if (valueCount == 1) {