11using namespace Types::Core;
20 : m_start(start), m_stop(stop), m_index(
index) {}
36 return ((b.
m_start < this->m_stop) && (b.
m_start >= this->m_start)) ||
49 if (b.
m_stop < this->m_stop)
59 throw std::invalid_argument(
"SplittingInterval: cannot apply the OR (|) "
60 "operator to non-overlapping "
61 "SplittingInterval's.");
65 if (b.
m_stop > this->m_stop)
87 TimeSplitterType::const_iterator it;
88 for (it = a.begin(); it != a.end(); ++it)
89 if (it->index() > max)
105 bool a_filter, b_filter;
109 if (a_filter && b_filter) {
111 }
else if (a_filter && !b_filter) {
113 }
else if (!a_filter && b_filter) {
118 throw std::invalid_argument(
"Cannot combine two splitters together, as the "
119 "output is undefined. Try splitting each "
120 "output workspace by b after the a split has "
140 if ((a.empty()) || (b.empty()))
143 TimeSplitterType::const_iterator ait;
144 TimeSplitterType::const_iterator bit;
148 for (ait = a.begin(); ait != a.end(); ++ait) {
149 for (bit = b.begin(); bit != b.end(); ++bit) {
150 if (ait->overlaps(*bit)) {
155 out.emplace_back(*ait & *bit);
169 out.reserve(a.size());
172 auto it = a.cbegin();
173 while (it != a.cend()) {
175 DateAndTime start = it->start();
176 DateAndTime stop = it->stop();
180 while ((it != a.cend()) && (it->start() <= stop)) {
183 if (it->stop() > stop)
188 out.emplace_back(start, stop, 0);
211 TimeSplitterType::const_iterator it;
213 for (it = a.begin(); it != a.end(); ++it)
214 if (it->stop() > it->start())
215 temp.emplace_back(*it);
216 for (it = b.begin(); it != b.end(); ++it)
217 if (it->stop() > it->start())
218 temp.emplace_back(*it);
242 if ((temp.empty())) {
243 out.emplace_back(DateAndTime::minimum(), DateAndTime::maximum(), 0);
247 TimeSplitterType::const_iterator ait;
249 if (ait != temp.end()) {
251 out.emplace_back(DateAndTime::minimum(), ait->start(), 0);
253 while (ait != temp.end()) {
254 DateAndTime start, stop;
257 if (ait == temp.end()) {
258 stop = DateAndTime::maximum();
262 out.emplace_back(start, stop, 0);
std::map< DeltaEMode::Type, std::string > index
Class holding a start/end time and a destination for splitting event lists and logs.
bool operator<(const SplittingInterval &b) const
Compare two splitter by the begin time.
Types::Core::DateAndTime m_stop
end
bool operator>(const SplittingInterval &b) const
Compare two splitter by the begin time.
Types::Core::DateAndTime stop() const
Return the stop time.
SplittingInterval()
Default constructor.
int index() const
Return the index (destination of this split time block)
bool overlaps(const SplittingInterval &b) const
Return true if the b SplittingInterval overlaps with this one.
int m_index
Index of the destination.
Types::Core::DateAndTime start() const
Return the start time.
Types::Core::DateAndTime m_start
begin
SplittingInterval operator|(const SplittingInterval &b) const
Or operator. Return the largest time interval.
double duration() const
Returns the duration in seconds.
MANTID_KERNEL_DLL TimeSplitterType operator&(const TimeSplitterType &a, const TimeSplitterType &b)
AND operator for TimeSplitterType Works on Filters - combines them to only keep times where both Filt...
TimeSplitterType removeFilterOverlap(const TimeSplitterType &a)
Remove any overlap in a filter (will not work properly on a splitter)
std::vector< SplittingInterval > TimeSplitterType
A typedef for splitting events according their pulse time.
bool compareSplittingInterval(const SplittingInterval &si1, const SplittingInterval &si2)
Comparator for sorting lists of SplittingInterval.
MANTID_KERNEL_DLL TimeSplitterType operator~(const TimeSplitterType &a)
NOT operator for TimeSplitterType Only works on Filters.
bool isFilter(const TimeSplitterType &a)
Return true if the TimeSplitterType provided is a filter, meaning that it only has an output index of...
MANTID_KERNEL_DLL TimeSplitterType operator|(const TimeSplitterType &a, const TimeSplitterType &b)
OR operator for TimeSplitterType Only works on Filters, not splitters.
MANTID_KERNEL_DLL TimeSplitterType operator+(const TimeSplitterType &a, const TimeSplitterType &b)
Plus operator for TimeSplitterType.
Helper class which provides the Collimation Length for SANS instruments.