]> git.donarmstrong.com Git - lilypond.git/blobdiff - flower/include/interval.hh
* The grand 2005-2006 replace.
[lilypond.git] / flower / include / interval.hh
index ddfdefd70b7d2a31b58a603258e5b578b82bf66d..9190f28544597f53664f78815f7b753a6a97fb21 100644 (file)
@@ -1,12 +1,14 @@
 /*
   interval.hh -- part of flowerlib
 
-  (c) 1996--2005 Han-Wen Nienhuys
+  (c) 1996--2006 Han-Wen Nienhuys
 */
 
 #ifndef INTERVAL_HH
 #define INTERVAL_HH
 
+#include <math.h>
+
 #include "flower-proto.hh"
 #include "drul-array.hh"
 
@@ -70,6 +72,11 @@ struct Interval_t : public Drul_array<T>
   {
     set_empty ();
   }
+  Interval_t (Drul_array<T> const &src)
+    : Drul_array<T> (src)
+  {
+  }
+
   Interval_t (T m, T M) : Drul_array<T> (m, M)
   {
   }
@@ -104,7 +111,7 @@ struct Interval_t : public Drul_array<T>
   }
   String to_string () const;
 
-  bool contains (T r);
+  bool contains (T r) const;
   void negate ()
   {
     T r = -elem (LEFT);
@@ -119,6 +126,11 @@ struct Interval_t : public Drul_array<T>
     elem_ref (LEFT) = elem (RIGHT);
     elem_ref (RIGHT) = t;
   }
+
+  static int left_comparison (Interval_t<T> const &a, Interval_t<T> const &b)
+  {
+    return sign (a[LEFT] - b[RIGHT]);
+  }
 };
 
 /**