]> git.donarmstrong.com Git - lilypond.git/blobdiff - flower/interval.cc
release: 0.0.65
[lilypond.git] / flower / interval.cc
index 6fac1f55dca0d754382282d600e35d25aab5309a..12152d6227a9042f43071fa1217c775e9f547b6c 100644 (file)
@@ -1,78 +1,19 @@
-#include <assert.h> 
-#include <math.h>
-#include "interval.hh"
-#include "string.hh"
-
-
-const Real INFTY = HUGE;
-
-void
-Interval::set_empty() {
-    min = INFTY;
-    max = -INFTY;
-}
-
-Real
-Interval::length() const {
-    assert(max >= min);
-    return max-min;
-}
-void
-Interval::unite(Interval h)
-{
-    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)
-{
-    a.intersect(b);
-    return a;
-    
-}
-int
-Interval::compare(const Interval&a,Interval const&b)
-{
-    if (a.min == b.min && a.max == b.max)
-       return 0;
-    
-    if (a.min <= b.min && a.max >= b.max)
-       return 1;
+/*
+  interval.cc -- instantiate Interval_t<Real>
 
-    if (a.min >= b.min && a.max <= b.max)
-       return -1;
+  source file of the Flower Library
 
-    assert(false);             // not comparable
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
 
-    return 0;
-}
+#include "interval.hh"
+#include "real.hh"
+#include "interval.tcc"
 
-Interval
-intersect(Interval x, Interval const &y)
-{
-    x.intersect(y);
-    return x;
-}
-    
+Interval__instantiate(Real);
 
-Interval::operator String() const
-{
-    if (empty())
-       return "[empty]";
-    String s("[");
-    return s + min + "," + max +"]";
-}
-bool
-Interval::elt_q(Real r)
+Real
+Interval_t<Real>::infinity() 
 {
-    return r >= min && r <= max;
+    return HUGE_VAL;
 }