#include "p-col.hh"
#include "score-column.hh"
-int
-Score_column::compare(Score_column & c1, Score_column &c2)
-{
- return sign(c1.when_ - c2.when_);
-}
-
-void
-Score_column::set_breakable()
-{
- pcol_l_->set_breakable();
-}
-
-Score_column::Score_column(Moment w)
+Score_column::Score_column (Moment w)
{
- when_ = w;
- pcol_l_ = new PCol(0);
- musical_b_ = false;
-}
-
-bool
-Score_column::used_b() {
- return pcol_l_->used_b();
+ when_ = w;
+ musical_b_ = false;
}
void
-Score_column::print() const
+Score_column::do_print() const
{
#ifndef NPRINT
- mtor << "Score_column { mus "<< musical_b_ <<" at " << when_<<'\n';
- mtor << "durations: [";
- for (int i=0; i < durations.size(); i++)
- mtor << durations[i] << " ";
- mtor << "]\n";
- pcol_l_->print();
- mtor << "}\n";
+ DOUT << "mus "<< musical_b_ <<" at " << when_<<'\n';
+ DOUT << "durations: [";
+ for (int i=0; i < durations.size(); i++)
+ DOUT << durations[i] << " ";
+ DOUT << "]\n";
+ Paper_column::do_print();
#endif
}
int
-Moment_compare(Moment &a , Moment& b)
+Moment_compare (Moment const &m1, Moment const &m2)
{
- return sign(a-b);
+ return sign (m1-m2);
}
void
Score_column::preprocess()
{
- durations.sort(Moment_compare);
+ durations.sort (Moment_compare);
}
+
void
-Score_column::add_duration(Moment d)
+Score_column::add_duration (Moment d)
{
- assert(d);
- for (int i = 0; i< durations.size(); i++) {
- if (d == durations[i])
- return ;
+ if (!d)
+ {
+ warning (_("Ignoring zero duration added to column at ")
+ + when_.str ());
+ return;
}
- durations.push(d);
+
+ for (int i = 0; i< durations.size(); i++)
+ {
+ if (d == durations[i])
+ return ;
+ }
+ durations.push (d);
}
-bool
-Score_column::breakable_b()
-{
- return pcol_l_->breakable_b();
-}
+IMPLEMENT_IS_TYPE_B1(Score_column, Paper_column);