]> git.donarmstrong.com Git - lilypond.git/blob - lily/colhpos.cc
d7850f5c27f1ccf0cf3f43587d20cfccf109dc22
[lilypond.git] / lily / colhpos.cc
1 /*
2   colhpos.cc -- implement Col_hpositions
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8
9 #include "colhpos.hh"
10 #include "real.hh"
11 #include "debug.hh"
12 #include "vector.hh"
13 #include "line-spacer.hh"
14
15 Col_hpositions::Col_hpositions()
16 {
17   energy_f_ = infinity_f;
18   ugh_b_ = false;
19   satisfies_constraints_b_ = false;
20   spacer_l_ =0;
21 }
22
23 Col_hpositions::~Col_hpositions()
24 {
25
26 }
27
28 void
29 Col_hpositions::add (PCol*c)
30 {
31   cols.push (c);
32 }
33
34 void
35 Col_hpositions::print() const
36 {
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
43 }
44
45 void
46 Col_hpositions::OK()const
47 {
48 #ifndef NDEBUG
49   assert (config.size() == cols.size ());
50 #endif
51 }
52
53 void
54 Col_hpositions::stupid_solution()
55 {
56   energy_f_ = infinity_f;
57   ugh_b_ = true;
58   config = spacer_l_->default_solution();
59 }
60
61 void
62 Col_hpositions::solve_line() 
63 {
64   spacer_l_->solve (this);
65 }
66
67
68 void
69 Col_hpositions::approximate_solve_line() 
70 {
71   spacer_l_->lower_bound_solution (this);
72 }
73
74