lilypond-0.1.59
[lilypond.git] / lily / colhpos.cc
bloba220298777d8868f21a0577ff342a512dddc01dc
1 /*
2 colhpos.cc -- implement Col_hpositions
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
9 #include "colhpos.hh"
10 #include "real.hh"
11 #include "debug.hh"
12 #include "vector.hh"
13 #include "line-spacer.hh"
15 Col_hpositions::Col_hpositions()
17 energy_f_ = infinity_f;
18 ugh_b_ = false;
19 satisfies_constraints_b_ = false;
20 spacer_l_ =0;
23 Col_hpositions::~Col_hpositions()
28 void
29 Col_hpositions::add (Paper_column*c)
31 cols.push (c);
34 void
35 Col_hpositions::print() const
37 #ifndef NPRINT
38 DOUT << "energy : " << energy_f_ << '\n';
39 DOUT << "line of " << config.size() << " cols\n";
40 Vector v (config);
41 DOUT << v;
42 #endif
45 void
46 Col_hpositions::OK() const
48 #ifndef NDEBUG
49 assert (config.size() == cols.size ());
50 #endif
53 void
54 Col_hpositions::set_stupid_solution(Vector v)
56 energy_f_ = infinity_f;
57 ugh_b_ = true;
58 config = v;
61 void
62 Col_hpositions::stupid_solution()
64 set_stupid_solution (spacer_l_->default_solution());
67 void
68 Col_hpositions::solve_line()
70 spacer_l_->solve (this);
74 void
75 Col_hpositions::approximate_solve_line()
77 spacer_l_->lower_bound_solution (this);