]> git.donarmstrong.com Git - lilypond.git/commitdiff
flower-1.0.16
authorfred <fred>
Fri, 20 Dec 1996 17:12:21 +0000 (17:12 +0000)
committerfred <fred>
Fri, 20 Dec 1996 17:12:21 +0000 (17:12 +0000)
flower/TODO
flower/interval.cc
flower/interval.hh

index 9d4ade3bcd4f1eb14101ff34f01c0212b4eeb8b5..6ce4b741d24e680a18156f11d44fea713ca54e68 100644 (file)
@@ -1,3 +1,6 @@
+
+       * PointerVec ?
+
        * PCursor -> Pointer_cursor / PointerCursor ?
 
        * efficient copy cons for List
@@ -12,9 +15,6 @@
 
        * use template handle in handle.hh for strings.
 
-       * Restricted cursor/list: make sublist from a list, and use rcursor
-as if list is as big as the sublist.
-
        * move towards gnu or STL?
 
                parsestream.h
index 6fac1f55dca0d754382282d600e35d25aab5309a..f176c7486fe5738ab5150ac46f22cdfab5b1ae4c 100644 (file)
@@ -17,20 +17,24 @@ Interval::length() const {
     assert(max >= min);
     return max-min;
 }
+
 void
 Interval::unite(Interval h)
 {
+    compare(h, *this );
     if (h.min<min)
        min = h.min;
     if (h.max>max)
        max = h.max;
 }
+
 void
 Interval::intersect(Interval h)
 {
     min = MAX(h.min, min);
     max = MIN(h.max, max);
 }
+
 Interval
 intersection(Interval a, Interval const&b)
 {
@@ -38,6 +42,7 @@ intersection(Interval a, Interval const&b)
     return a;
     
 }
+
 int
 Interval::compare(const Interval&a,Interval const&b)
 {
@@ -62,8 +67,8 @@ intersect(Interval x, Interval const &y)
     return x;
 }
     
-
-Interval::operator String() const
+String
+Interval::str() const
 {
     if (empty())
        return "[empty]";
index a7a269153bf42ba9e34502011909dd0358a27bd4..5331c1d12534f78da11277ba627743905f366f20 100644 (file)
@@ -16,6 +16,9 @@
 struct Interval {
     Real min, max;
 
+    /****************/
+    
+    Real center() { return (min + max) /2;}
     void translate(Real t) {
        min += t;
        max += t;
@@ -31,6 +34,10 @@ struct Interval {
                
     }
     void unite(Interval h) ;
+    /**
+      PRE
+      *this and h are comparable
+      */
     void intersect(Interval h);
 
     Real length() const;
@@ -49,13 +56,17 @@ struct Interval {
        return *this;
     }
     bool elt_q(Real r);
-    operator String() const;
+    String str() const;
 
     /// partial ordering
     static compare(const Interval&,Interval const&);
+    /**
+      inclusion ordering. Crash if not comparable.
+      */
 };
 /**
-  this represents the closed interval [min,max]
+  this represents the closed interval [min,max].
+  No invariants
   */
 
 Interval intersection(Interval, Interval const&);
@@ -64,6 +75,19 @@ Interval intersection(Interval, Interval const&);
 
 instantiate_compare(Interval&, Interval::compare);
 
+
+inline
+Interval operator +(double a,Interval i )
+{
+    i += a;
+    return i;
+}
+
+inline
+Interval operator +(Interval i,double a ){
+    return a+i;
+}
+
 #endif // INTERVAL_HH