* @param new_frame the new interval.
*
* Adds the interval to the list and joins overlapping intervals.
+ *
+ * @internal complexity O(n).
*/
void Intervals::add(const Interval& new_frame)
{
*
* removes the time interval from the list; cut off parts from or remove existing
* intervals if they overlap.
+ *
+ * @internal complexity O(n).
*/
void Intervals::sub(const Interval& del_frame)
{
*
* @internal we rely on the fact that the lists are sorted and contain
* disjoint intervals.
+ *
+ * So this method has a complexity of O(n).
*/
bool Intervals::contains(const Intervals& other) const
{
++other_it;
}
return (other_it == other.end());
-} // eo Intervals::comtains(const Intervals&) const
+} // eo Intervals::contains(const Intervals&) const
+/**
+ * @brief combines to interval combinates for equality
+ * @param other the other instance.
+ * @return @a true if the other is equal to the current.
+ *
+ * @internal since the lists are sorted, we compare the interval lists.
+ * Thus we have a complexity of O(n).
+ */
bool Intervals::operator==(const Intervals& other) const
{
// since we keep sorted lists: just compare the lists :-)
} // eo operator-=(const Interval&)
+/**
+ * @brief adds the intervals of a second instance to us.
+ * @param other the other instance.
+ * @return self reference (allow chaining).
+ *
+ * @internal since we do simple loops over the other and our intervals
+ * we have a complexity of O(n^2).
+ *
+ * @todo optimize if complexity becomes a problem.
+ */
Intervals& Intervals::operator+=(const Intervals& other)
{
for(const_iterator it= other.begin();
} // eo operator+=(const Intervals&)
+/**
+ * @brief subtracts the intervals of a second instance from us.
+ * @param other the other instance.
+ * @return self reference (allow chaining).
+ *
+ * @internal since we do simple loops over the other and our intervals
+ * we have a complexity of O(n^2).
+ *
+ * @todo optimize if complexity becomes a problem.
+ */
Intervals& Intervals::operator-=(const Intervals& other)
{
if (&other == this)
} // eo operator==(const Interval&)
+ bool operator!=(const Interval& other) const
+ {
+ return not (*this == other);
+ } // eo operator!=(const Interval&)
+
+
/**
* @brief less operator. compares only the start times!
* @param other the other interval to compare with.
bool contains(const Intervals& other) const;
bool operator==(const Intervals& other) const;
- bool operator!=(const Intervals& other) const {return not (*this == other) ; }
+ bool operator!=(const Intervals& other) const { return not (*this == other) ; }
Intervals& operator+=(const Interval& other);
Intervals& operator-=(const Interval& other);