From 164cf2ac44dd14a10fc021756e67855e8820da35 Mon Sep 17 00:00:00 2001 From: Rune Zedeler Date: Sun, 9 Dec 2007 20:25:47 +0100 Subject: [PATCH] Pitch_interval::add_point () returns expand direction instead of void --- lily/include/pitch-interval.hh | 4 ++-- lily/pitch-interval.cc | 32 ++++++++++++++++++++++++-------- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/lily/include/pitch-interval.hh b/lily/include/pitch-interval.hh index 947e418ea0..478b58a7a8 100644 --- a/lily/include/pitch-interval.hh +++ b/lily/include/pitch-interval.hh @@ -16,7 +16,7 @@ class Pitch_interval : public Drul_array 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 public: Pitch_lexicographic_interval (); Pitch_lexicographic_interval (Pitch, Pitch); - void add_point (Pitch); + Direction add_point (Pitch); bool is_empty () const; }; diff --git a/lily/pitch-interval.cc b/lily/pitch-interval.cc index f871e7e185..84d4911498 100644 --- a/lily/pitch-interval.cc +++ b/lily/pitch-interval.cc @@ -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; } -- 2.39.5