DataMiningValidInterval.cc
2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
* DataMiningValidInterval.cc
*
* Created on: 3 oct. 2013
* Author: CS
*/
#include "DataMiningValidInterval.hh"
// TimeTable
#include "TimeTableCatalogUtil.hh"
using namespace TimeTableCatalog;
namespace AMDA {
namespace ParamOutputImpl {
namespace DataMining {
log4cxx::LoggerPtr DataMiningValidInterval::_logger(log4cxx::Logger::getLogger("AMDA-Kernel.DataMiningValidInterval"));
DataMiningValidInterval::DataMiningValidInterval(std::string pPrefixTTFileName, bool pIsGapFile, ParamOutputDataMining* pParamOutputDataMining) :
DataMiningType(pParamOutputDataMining, pPrefixTTFileName),
_valCurrent(false),
_beginTimeInterval(0),
_endTimeInterval(0),
_isGapFile(pIsGapFile){
}
void DataMiningValidInterval::setTimeInterval(const TimeInterval& pTimeInterval) {
DataMiningType::setTimeInterval(pTimeInterval);
_valCurrent = false;
_beginTimeInterval = 0;
_endTimeInterval = 0;
}
void DataMiningValidInterval::checkTimeIntervalBounds() {
// If the begin time of the interval is the same value as the start time research,
// We must not subtract samplingTime / 2 to the _beginTimeInterval (boundary value)
// TODO prendre en compte une liste d'intervalle de temps
// et non plus une date de départ suivi d'un délai.
if (_beginTimeInterval != _inputTimeInterval._startTime) {
_beginTimeInterval = _beginTimeInterval - (_samplingTime / 2);
}
if(_endTimeInterval != _inputTimeInterval._stopTime) {
_endTimeInterval = _endTimeInterval + (_samplingTime / 2);
} else {
// Nothing to do we have reached the end time research so we must not
// add samplingTime / 2 to the _endTimeInterval (boundary value).
}
}
void DataMiningValidInterval::finalize() {
// If the last interval is not closed, so close it.
if(_valCurrent) {
_timeTable->addInterval(TimeInterval(_beginTimeInterval - (_samplingTime / 2), _inputTimeInterval._stopTime));
}
}
void DataMiningValidInterval::fillInformation(TimeTable::TIME_FORMAT pTimeFormat, std::string pFileName, int pIndex) {
finalize();
DataMiningType::fillInformation(pTimeFormat, pFileName, pIndex);
}
} // DataMining
} // ParamOutputImpl
} // AMDA