text
stringlengths
0
234
delay 2.0;
end loop;
-- Lab Step 5
--Five vehicles rejected.
--Calculate and print results
Function Definition: function Object_Distance( Obj: Thing_Type; Ray: Ray_Type ) return Float15 is
Function Body: begin
case Obj.Kind is
when Sphere =>
declare
Eo: constant Vector := Obj.Center - Ray.Start;
V: constant Float15 := Eo * Ray.Dir;
begin
if V > 0.0 then
declare
Disc: constant Float15 := Obj.Radius2 - ( Eo * Eo - V * V );
begin
if Disc > 0.0 then
return V - Sqrt(Disc);
end if;
Function Definition: function Convert is new Ada.Unchecked_Conversion
Function Body: (A,
B);
Configure : B := Convert (My_Event);
begin
GPU.Resize
(Context,
C.unsigned (Configure.width),
C.unsigned (Configure.height));
Function Definition: procedure Run is
Function Body: begin
for II in 1 .. Int (Len) loop
My_Queue.Enqueue (II);
end loop;
for II in 1 .. Int (Len) loop
declare
Current : Int;
begin
My_Queue.Dequeue (Current);
if Current /= II then
raise Program_Error with Int'Image (Current) & " /= " & Int'Image (II);
end if;
Function Definition: procedure Do_Work is
Function Body: begin
loop
declare
New_Command : Any_Command;
begin
My_Command_Queue.Dequeue (New_Command);
case New_Command.C.T is
when Invalid_Type =>
raise Program_Error;
when Write_Type =>
Do_Write (New_Command.C.Write_Object);
when Read_Type =>
Do_Read (New_Command.C.Read_Object);
when Poll_Type =>
Do_Poll (New_Command.C.Poll_Object);
when Remind_Me_Type =>
Do_Remind_Me (New_Command.C.Remind_Me_Object);
end case;
Function Definition: procedure init_simulation_engine_choice is
Function Body: begin
simulation_engine_choice := QComboBoxH (QObject_findChild (QObjectH (covidsim_form), s2qs ("simulation_engine_choice")));
for s in simulation_engine loop
QStringList_append(handle => simulation_engines, s => s2qs(enum_image_to_beautiful_image(s'Image)));
end loop;
QComboBox_addItems (handle => simulation_engine_choice, texts => simulation_engines);
Function Definition: procedure update_simulation is
Function Body: scenario_name : String := beautiful_image_to_enum_image(qs2s(QComboBox_currentText(scenario_choice)));
results : Simulation_Data := Simulation(Scenario'Value(scenario_name), QSpinBox_value(number_population), QSpinBox_value(number_iterations));
begin
update_line_chart(results, QComboBox_currentText(scenario_choice));
Function Definition: procedure set_simulation_engine_panel is
Function Body: simulation_engine_name : String := beautiful_image_to_enum_image(qs2s(QComboBox_currentText(simulation_engine_choice)));
simulation_choice : Simulation_Engine := Simulation_Engine'Value(simulation_engine_name);
stack : QStackedWidgetH := QStackedWidgetH (QObject_findChild (QObjectH (covidsim_form), s2qs ("simulation_panels")));
begin
if simulation_choice = XPH_Pharmaceutical then
QStackedWidget_setCurrentIndex (stack, 0);
slot_change_country_choice (s2qs (""));
end if;