From 453c4de79fe6f2d73b1951ee64b5fec50499fc8f Mon Sep 17 00:00:00 2001 From: fred Date: Mon, 23 Dec 1996 19:06:32 +0000 Subject: [PATCH] lilypond-0.0.21 --- src/grouping.cc | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/src/grouping.cc b/src/grouping.cc index 3252178849..c7d38dbdae 100644 --- a/src/grouping.cc +++ b/src/grouping.cc @@ -2,6 +2,13 @@ #include "grouping.hh" #include "interval.hh" +void +Rhythmic_grouping::init() +{ + interval_ = 0; + children.set_size(0); +} + void Rhythmic_grouping::OK()const { @@ -65,19 +72,6 @@ Rhythmic_grouping::intervals() } return r; } - -Rhythmic_grouping::Rhythmic_grouping(MInterval t, int n) -{ - if (n == 1 || !n) { - interval_ = new MInterval(t); - return; - } - Moment dt = t.length()/n; - MInterval basic = MInterval(t.left, t.left+dt); - for (int i= 0; i < n; i++) - children.add(new Rhythmic_grouping( dt*i + basic )); -} - void Rhythmic_grouping::intersect(MInterval t) { @@ -143,6 +137,21 @@ Rhythmic_grouping::split(svec splitpoints) children = ch; } + +Rhythmic_grouping::Rhythmic_grouping(MInterval t, int n) +{ + init(); + if (n == 1 || !n) { + interval_ = new MInterval(t); + return; + } + Moment dt = t.length()/n; + MInterval basic = MInterval(t.left, t.left+dt); + for (int i= 0; i < n; i++) + children.add(new Rhythmic_grouping( dt*i + basic )); +} + + Rhythmic_grouping::Rhythmic_grouping(svec r) :children(r) { @@ -152,6 +161,7 @@ Rhythmic_grouping::Rhythmic_grouping(svec r) Rhythmic_grouping::~Rhythmic_grouping() { junk(); + } void @@ -171,6 +181,7 @@ Rhythmic_grouping::operator=(Rhythmic_grouping const &s) Rhythmic_grouping::Rhythmic_grouping(Rhythmic_grouping const&s) { + init(); copy(s); } @@ -178,10 +189,9 @@ void Rhythmic_grouping::junk() { delete interval_; - interval_ = 0; for (int i=0; i < children.sz(); i++) delete children[i]; - children.set_size(0); + init(); } void -- 2.39.5