[MERGE] libi2ncommon: (reinhard) added contains_exact method to interval classes.
authorThomas Jarosch <thomas.jarosch@intra2net.com>
Tue, 8 Jul 2008 11:43:40 +0000 (11:43 +0000)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Tue, 8 Jul 2008 11:43:40 +0000 (11:43 +0000)
src/timefunc.cpp
src/timefunc.hxx

index a676a3f..26fe10a 100644 (file)
@@ -648,6 +648,29 @@ bool Intervals::contains(const Interval& other) const
 
 
 /**
+ * @brief returns if we contain an exact interval.
+ * @param other the interval to check.
+ * @return @a true if we axactly contains the given interval.
+ *
+ * @note thsi differs from contain in the way, that we return only @a true
+ * iff we have the given interval in our list; not only cover it.
+ */
+bool Intervals::contains_exact(const Interval& other) const
+{
+    for(const_iterator it= begin();
+        it != end();
+        ++it)
+    {
+        if ( *it == other)
+        {
+            return true;
+        }
+    }
+    return false;
+} // eo Intervals::contains_exact(const Interval&)const
+
+
+/**
  * @brief returns if we contain another interval combination.
  * @param other the intervals to check.
  * @return @a true if we cover the given intervals, too.
index 42b1275..c7b4e95 100644 (file)
@@ -286,6 +286,8 @@ class Intervals
         bool contains(const Interval& other) const;
         bool contains(const Intervals& other) const;
 
+        bool contains_exact(const Interval& other) const;
+
         bool operator==(const Intervals& other) const;
         bool operator!=(const Intervals& other) const { return not (*this == other) ; }