Blame view

src/ParamOutputImpl/DataMining/DataMiningValidInterval.cc 2.2 KB
fbe3c2bb   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * 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"));

63fff7ed   Benjamin Renard   Support integer i...
22
			DataMiningValidInterval::DataMiningValidInterval(std::string pPrefixTTFileName, bool pIsGapFile, ParamOutputDataMining* pParamOutputDataMining) :
fbe3c2bb   Benjamin Renard   First commit
23
24
25
26
				DataMiningType(pParamOutputDataMining, pPrefixTTFileName),
				_valCurrent(false),
				_beginTimeInterval(0),
				_endTimeInterval(0),
63fff7ed   Benjamin Renard   Support integer i...
27
				_isGapFile(pIsGapFile){
fbe3c2bb   Benjamin Renard   First commit
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
			}

			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).
				}
			}

fbe3c2bb   Benjamin Renard   First commit
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
			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