Exemplo n.º 1
0
 void numeric_spinner::max(double val)
 {
     max_ = val;
     if (max_ < min_) min_ = max_;
     if (value_ > max_) value_ = max_;
     build_label();
 }
Exemplo n.º 2
0
 void numeric_spinner::min(double val)
 {
     min_ = val;
     if (min_ > max_) max_ = min_;
     if (value_ < min_) value_ = min_;
     build_label();
 }
Exemplo n.º 3
0
        void ds_query_batch() {
            dc->cout() << "\n1 Start building label system..." << 
                std::endl;
            build_label(n_tree);

            for (size_t i = 0; i < n_query; i += n_query_batch) {
                dc->cout() << "\n2 Perform DS..." << std::endl;
                dc->cout() << "\t2.0 Reading test cases..." << std::endl;
                results.resize(dc->numprocs());
                inst_set.resize(dc->numprocs());
                size_t n_query_to_perform = 
                    std::min(n_query_batch, n_query - i * n_query_batch);
                read_tcs(n_query_to_perform);

                dc->cout() << "\t2.1 Gather dest codes..." << std::endl;
                gather_dst();

                dc->cout() << "\t2.2 Create gs inst..." << std::endl;
                create_instances();

                dc->cout() << "\t2.3 Start dec search... " << std::endl;
                start_ds_search();

                dc->cout() << "\t2.4 Gathering results..." << std::endl;
                ds_aggregate_results();

                dc->cout() << "\t2.5 Clean containers..." << std::endl;
                post_processing();
            }

            dc->cout() << "\n3 Writing results to file..." << std::endl;
            ds_write_results();

            dc->cout() << "\nDone." << std::endl;
        }
Exemplo n.º 4
0
 numeric_spinner::numeric_spinner(const rectangle& rect, double min, double max, 
         double increment, int precision, bool wrap) : widget(rect), min_(min), max_(max), 
         increment_(increment), value_(min), precision_(precision), wrap_(wrap)
 {
     INFO("constructor");
     focusable(true);
     build_label();
 }
Exemplo n.º 5
0
 void numeric_spinner::precision(int val)
 {
     if (val >= 0)
     {
         precision_ = val;
         build_label();
     }
     else
         throw error_message_exception("cannot set precision < 0");
 }
Exemplo n.º 6
0
 void numeric_spinner::handle_event(event::ptr e)
 {
     switch (e->type())
     {
         case event::key_down:
             {
                 key_event::ptr ke = boost::shared_static_cast<key_event>(e);
                 switch ( ke->fn_key() )
                 {
                     case key_enter:
                     case key_uparrow:
                         value_ = value_+increment_;
                         if (value_ > max_)
                         {	
                             if (wrap_) value_ = min_;
                             else value_ = max_;
                         }
                         build_label();
                         on_change();
                         redraw(rect());
                         return;
                         break;
                     case key_downarrow:
                         value_ = value_-increment_;
                         if (value_ < min_) 
                         {
                             if (wrap_) value_ = max_;
                             else value_ = min_;
                         }
                         build_label();
                         on_change();
                         redraw(rect());
                         return;
                         break;
                 }
                 break;
             }
         case event::mouse_up:
             {
                 mouse_event::ptr me = boost::shared_static_cast<mouse_event>(e);
                 if (region(me->x(), me->y()) == DOWN_ARROW)
                 {
                     value_ = value_-increment_;
                     if (value_ < min_) 
                     {
                         if (wrap_) value_ = max_;
                         else value_ = min_;
                     }
                 }
                 else
                 {
                     value_ = value_+increment_;
                     if (value_ > max_)
                     {	
                         if (wrap_) value_ = min_;
                         else value_ = max_;
                     }
                 }
                 build_label();
                 on_change();
                 redraw(rect());
                 return;
             }
     }
     widget::handle_event(e);
 }