lilypond-1.4.4
[lilypond.git] / lily / colhpos.cc
blobf23646cb019b9bfb7a8f15e5dbd2e97fc229ecf1
1 /*
2 colhpos.cc -- implement Column_x_positions
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
9 #include "colhpos.hh"
10 #include "real.hh"
11 #include "debug.hh"
12 #include "vector.hh"
13 #include "line-spacer.hh"
15 Column_x_positions::Column_x_positions()
17 energy_f_ = infinity_f;
18 satisfies_constraints_b_ = false;
19 spacer_l_ =0;
22 Column_x_positions::~Column_x_positions()
27 void
28 Column_x_positions::add_paper_column (Paper_column*c)
30 cols_.push (c);
33 void
34 Column_x_positions::print() const
36 #ifndef NPRINT
37 DOUT << "energy : " << energy_f_ << '\n';
38 DOUT << "line of " << config_.size() << " cols\n";
39 Vector v (config_);
40 DOUT << v;
41 #endif
44 void
45 Column_x_positions::OK() const
47 #ifndef NDEBUG
48 assert (config_.size() == cols_.size ());
49 #endif
52 void
53 Column_x_positions::set_stupid_solution(Vector v)
55 energy_f_ = infinity_f;
56 config_ = v;
59 void
60 Column_x_positions::stupid_solution()
62 set_stupid_solution (spacer_l_->default_solution());
65 void
66 Column_x_positions::solve_line()
68 spacer_l_->solve (this);
72 void
73 Column_x_positions::approximate_solve_line()
75 spacer_l_->lower_bound_solution (this);