]> git.donarmstrong.com Git - lilypond.git/blobdiff - src/sccol.cc
release: 0.0.22
[lilypond.git] / src / sccol.cc
index c29d26cf4a3b98e9ca844da4c517bcf1bffc0119..bbd0dba1aeda4e56d77c8596591d7d34c106ec7a 100644 (file)
@@ -1,28 +1,62 @@
-#include "sccol.hh"
 #include "debug.hh"
+#include "pcol.hh"
+#include "sccol.hh"
+
+int
+Score_column::compare(Score_column & c1, Score_column &c2)
+{
+       return sign(c1.when_ - c2.when_);
+}
 
-Score_column::Score_column(Real w)
+void
+Score_column::set_breakable()
 {
-    when = w;
-    pcol_ = new PCol(0);
-    musical = false;
+    pcol_l_->set_breakable();
+}
+
+Score_column::Score_column(Moment w)
+{
+    when_ = w;
+    pcol_l_ = new PCol(0);
+    musical_ = false;
 }
 
 bool
 Score_column::used() {
-    return pcol_->used();
+    return pcol_l_->used();
 }
 
 void
 Score_column::print() const
 {
 #ifndef NPRINT
-    mtor << "Score_column { mus "<< musical <<" at " <<  when<<'\n';
+    mtor << "Score_column { mus "<< musical_ <<" at " <<  when_<<'\n';
     mtor << "durations: [";
-    for (int i=0; i < durations.sz(); i++)
+    for (int i=0; i < durations.size(); i++)
        mtor << durations[i] << " ";
     mtor << "]\n";
-    pcol_->print();
+    pcol_l_->print();
     mtor << "}\n";
 #endif
 }
+
+int
+Tdescription_compare(Moment &a , Moment& b)
+{
+    return sign(a-b);
+}
+
+void
+Score_column::preprocess()
+{
+    durations.sort(Tdescription_compare);
+}
+void
+Score_column::add_duration(Moment d)
+{
+    for (int i = 0; i< durations.size(); i++) {
+       if (d == durations[i])
+           return ;
+    }
+    durations.add(d);
+}