text stringlengths 0 234 |
|---|
Displayed_time := Fractionnal_day_of (This_historical_time); |
M_date := JD_to_Milesian (This_Julian_day); |
when 'Y' => |
M_Date := (1, 1, -4712); |
This_hour := 12; This_minute := 0; This_second := 0; |
Get (This_year); M_date.year := This_year; |
Skip_Line; |
-- Conversion section: compute "doomsday" |
This_Julian_day := Milesian_to_JD (M_date); |
-- Set to "doomsday" |
Day_time := 3600.0 * This_hour + 60.0 * This_minute + 1.0 * This_second; |
This_historical_time := Julian_Duration_Of (This_Julian_day) |
+ Day_Julian_Offset (Day_time) |
- To_Doomsday_time_duration; |
This_Julian_day := Julian_Day_Of (This_historical_time); |
M_date := jd_to_milesian (This_Julian_day); |
Displayed_time := Fractionnal_day_of (This_historical_time); |
when 'A' => |
declare |
Days : Julian_Day_Duration := 0; |
Hour_Offset, Minute_Offset, Second_Offset : Integer := 0; |
Julian_Time_Offset : Historical_Duration := 0.0; |
begin |
-- Get section |
Get (Days); |
if not End_Of_Line then Get (Hour_Offset); end if; |
if not End_Of_Line then Get (Minute_Offset); end if; |
if not End_Of_Line then Get (Second_Offset); end if; |
Skip_Line; |
-- Conversion section |
Julian_Time_Offset := Julian_Duration_Of |
(3600.0 * Hour_Offset |
+ 60.0 * Minute_Offset |
+ 1.0 * Second_Offset); |
This_historical_time := |
This_historical_time + Julian_Duration_Of (Days) + Julian_Time_Offset ; |
This_Julian_day := Julian_Day_Of (This_historical_time); |
M_date := jd_to_milesian (This_Julian_day); |
Julian_hour := This_historical_time - Julian_Duration_Of (This_Julian_day); |
Displayed_time := Fractionnal_day_of (This_historical_time); |
begin |
Day_time := Day_Offset (Julian_hour); |
exception |
when Constraint_Error => |
Put("Day time out of bounds - correcting"); New_Line; |
Day_time := 86_399.88; |
-- avoids out of bounds. |
Function Definition: procedure match is |
Function Body: type Edge_Record is record |
id : Natural; |
conf : Configuration; |
end record; |
package Edge_Maps is new Ada.Containers.Indefinite_Hashed_Maps |
(Key_Type => Line_Value, |
Element_Type => Edge_Record, |
Hash => line_hash, |
Equivalent_Keys => "="); |
use Edge_Maps; |
edge_map : Edge_Maps.Map := Edge_Maps.Empty_Map; |
begin |
for c in tiles.Iterate loop |
declare |
t : Tile := tiles(c); |
es : constant Edge_Sets.Set := get_edges(t.id); |
begin |
for val of es loop |
if edge_map.contains(val) then |
declare |
matched_edge : constant Edge_Record := edge_map(val); |
matched_tile : Tile := tiles(matched_edge.id); |
begin |
matched_tile.neighbors.include(t.id); |
tiles(matched_tile.id) := matched_tile; |
t.neighbors.include(matched_tile.id); |
tiles(c) := t; |
Function Definition: procedure rotate_complete_image is |
Function Body: max : constant Natural := Natural(Ada.Numerics.Elementary_Functions.sqrt(Float(tiles.length)) * 8.0) - 1; |
new_image : Complete_Image_Sets.Set := Complete_Image_Sets.Empty_Set; |
begin |
for pixel of complete_image loop |
new_image.insert(Position'(x=>pixel.y, y=>max-pixel.x)); |
end loop; |
complete_image := new_image; |
end rotate_complete_image; |
procedure flip_complete_image is |
max : constant Natural := Natural(Ada.Numerics.Elementary_Functions.sqrt(Float(tiles.length)) * 8.0) - 1; |
new_image : Complete_Image_Sets.Set := Complete_Image_Sets.Empty_Set; |
begin |
for pixel of complete_image loop |
new_image.insert(Position'(x=>max-pixel.x, y=>pixel.y)); |
end loop; |
complete_image := new_image; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.