Pitch_interval::add_point () returns expand direction instead of void
authorRune Zedeler <rune@lilypond.org>
Sun, 9 Dec 2007 19:25:47 +0000 (20:25 +0100)
committerRune Zedeler <rune@lilypond.org>
Sun, 9 Dec 2007 19:25:47 +0000 (20:25 +0100)
lily/include/pitch-interval.hh
lily/pitch-interval.cc

index 947e418ea0f10bfeccc7b83dcab614706f642284..478b58a7a8c5dff38cf559db52012cd881555f28 100644 (file)
@@ -16,7 +16,7 @@ class Pitch_interval : public Drul_array<Pitch>
 public:
   Pitch_interval ();
   Pitch_interval (Pitch, Pitch);
-  void add_point (Pitch);
+  Direction add_point (Pitch);
   bool is_empty () const;
 };
 
@@ -25,7 +25,7 @@ class Pitch_lexicographic_interval : public Drul_array<Pitch>
 public:
   Pitch_lexicographic_interval ();
   Pitch_lexicographic_interval (Pitch, Pitch);
-  void add_point (Pitch);
+  Direction add_point (Pitch);
   bool is_empty () const;
 };
 
index f871e7e185b000df6cb1dfd8f6010a3e2c1fbfaa..84d4911498525bcabf2decdb443af58a6e5c14a7 100644 (file)
@@ -28,13 +28,21 @@ Pitch_interval::is_empty () const
   return at (LEFT) > at (RIGHT);
 }
 
-void
+Direction
 Pitch_interval::add_point (Pitch p)
 {
   if (at (LEFT).tone_pitch () > p.tone_pitch ())
-    at (LEFT) = p;
-  if (at (RIGHT).tone_pitch () < p.tone_pitch ())
-    at (RIGHT) = p;
+    {
+      at (LEFT) = p;
+      return LEFT;
+    }
+  else if (at (RIGHT).tone_pitch () < p.tone_pitch ())
+    {
+      at (RIGHT) = p;
+      return RIGHT;
+    }
+  else
+    return CENTER;
 }
 
 
@@ -56,11 +64,19 @@ Pitch_lexicographic_interval::is_empty () const
   return at (LEFT) > at (RIGHT);
 }
 
-void
+Direction
 Pitch_lexicographic_interval::add_point (Pitch p)
 {
   if (at (LEFT) > p)
-    at (LEFT) = p;
-  if (at (RIGHT) < p)
-    at (RIGHT) = p;
+    {
+      at (LEFT) = p;
+      return LEFT;
+    }
+  else if (at (RIGHT) < p)
+    {
+      at (RIGHT) = p;
+      return RIGHT;
+    }
+  else
+    return CENTER;
 }