19928/jj_vitp/Implementation/classes/attributes/sea_area_attributes.e

80 lines
2.8 KiB
Plaintext
Raw Normal View History

2024-06-17 07:09:33 +00:00
note
description: "[
Class incapsulating each {SEA_AREA} in VITP and responsible for
the creation of those attributes. Decomposed into this class
so that {VITP_GAME} would not be such a large file.
These attributes are used as pseudo-constants. I elected
not to use once features becasue the order of calls to
once featues may not work for persistence.
]"
author: "Jimmy J. Johnson"
date: "$Date$"
revision: "$Revision$"
deferred class
SEA_AREA_ATTRIBUTES
feature -- Access
game: VITP_GAME
-- The game in which this item belongs.
deferred
end
feature -- Access (sea areas)
Aleutian_islands: ALEUTIAN_ISLANDS attribute create Result.make (game) end
Bay_of_bengal: BAY_OF_BENGAL attribute create Result.make (game) end
Central_pacific_ocean: CENTRAL_PACIFIC_OCEAN attribute create Result.make (game) end
Coral_Sea: CORAL_SEA attribute create Result.make (game) end
Hawaiian_islands: HAWAIIAN_ISLANDS attribute create Result.make (game) end
Indian_ocean: INDIAN_OCEAN attribute create Result.make (game) end
Indonesia: INDONESIA attribute create Result.make (game) end
Japanese_islands: JAPANESE_ISLANDS attribute create Result.make (game) end
Marianas_islands: MARIANAS_ISLANDS attribute create Result.make (game) end
Marshall_islands: MARSHALL_ISLANDS attribute create Result.make (game) end
North_pacific_ocean: NORTH_PACIFIC_OCEAN attribute create Result.make (game) end
South_pacific_ocean: SOUTH_PACIFIC_OCEAN attribute create Result.make (game) end
US_mandate: US_MANDATE attribute create Result.make (game) end
feature -- Access (groups)
sea_areas: VITP_TABLE [SEA_AREA]
-- Convenience feature containing all the sea areas on the board
attribute
create Result.make (13)
Result.extend (Aleutian_islands, Aleutian_islands.name)
Result.extend (Bay_of_bengal, Bay_of_bengal.name)
Result.extend (Central_pacific_ocean, Central_pacific_ocean.name)
Result.extend (Coral_sea, Coral_sea.name)
Result.extend (Hawaiian_islands, Hawaiian_islands.name)
Result.extend (Indian_ocean, Indian_ocean.name)
Result.extend (Indonesia, Indonesia.name)
Result.extend (Japanese_islands, Japanese_islands.name)
Result.extend (Marianas_islands, Marianas_islands.name)
Result.extend (Marshall_islands, Marshall_islands.name)
Result.extend (North_pacific_ocean, North_pacific_ocean.name)
Result.extend (South_pacific_ocean, South_pacific_ocean.name)
Result.extend (US_mandate, US_mandate.name)
end
contested_areas: LINKED_SET [SEA_AREA]
-- Sea areas that contain both Japanese and Allied units
local
s: SEA_AREA
do
create Result.make
from Sea_areas.start
until Sea_areas.after
loop
s := Sea_areas.item_for_iteration
if s.is_contested then
Result.extend (s)
end
Sea_areas.forth
end
end
end