+
+Moment
+Beaming_pattern::start_moment (int i) const
+{
+ return infos_.at (i).start_moment_;
+}
+
+Moment
+Beaming_pattern::end_moment (int i) const
+{
+ Duration *dur = new Duration (2 + max (beamlet_count (i, LEFT),
+ beamlet_count (i, RIGHT)),
+ 0);
+
+ return infos_.at (i).start_moment_ + dur->get_length ();
+}
+
+bool
+Beaming_pattern::invisibility (int i) const
+{
+ return infos_.at (i).invisible_;
+}
+
+/*
+ Split a beamin pattern at index i and return a new
+ Beaming_pattern containing the removed elements
+*/
+Beaming_pattern *
+Beaming_pattern::split_pattern (int i)
+{
+ Beaming_pattern *new_pattern = 0;
+ int count;
+
+ new_pattern = new Beaming_pattern ();
+ for (vsize j = i + 1; j < infos_.size (); j++)
+ {
+ count = max (beamlet_count (j, LEFT), beamlet_count (j, RIGHT));
+ new_pattern->add_stem (start_moment (j),
+ count,
+ invisibility (j));
+ }
+ for (vsize j = i + 1; j < infos_.size ();)
+ infos_.pop_back ();
+ return (new_pattern);
+}
+
+void
+Beaming_options::from_context (Context *context)
+{
+ grouping_ = context->get_property ("beatStructure");
+ subdivide_beams_ = to_boolean (context->get_property ("subdivideBeams"));
+ base_moment_ = robust_scm2moment (context->get_property ("baseMoment"),
+ Moment (1, 4));
+ measure_length_ = robust_scm2moment (context->get_property ("measureLength"),
+ Moment (4, 4));
+}
+
+Beaming_options::Beaming_options ()
+{
+ grouping_ = SCM_EOL;
+ subdivide_beams_ = false;
+}