| 1 |
-- C390A030.A |
| 2 |
-- |
| 3 |
-- Grant of Unlimited Rights |
| 4 |
-- |
| 5 |
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, |
| 6 |
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained |
| 7 |
-- unlimited rights in the software and documentation contained herein. |
| 8 |
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making |
| 9 |
-- this public release, the Government intends to confer upon all |
| 10 |
-- recipients unlimited rights equal to those held by the Government. |
| 11 |
-- These rights include rights to use, duplicate, release or disclose the |
| 12 |
-- released technical data and computer software in whole or in part, in |
| 13 |
-- any manner and for any purpose whatsoever, and to have or permit others |
| 14 |
-- to do so. |
| 15 |
-- |
| 16 |
-- DISCLAIMER |
| 17 |
-- |
| 18 |
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR |
| 19 |
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED |
| 20 |
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE |
| 21 |
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE |
| 22 |
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A |
| 23 |
-- PARTICULAR PURPOSE OF SAID MATERIAL. |
| 24 |
--* |
| 25 |
-- |
| 26 |
-- OBJECTIVE: |
| 27 |
-- See C390A031.AM. |
| 28 |
-- |
| 29 |
-- TEST DESCRIPTION: |
| 30 |
-- See C390A031.AM. |
| 31 |
-- |
| 32 |
-- TEST FILES: |
| 33 |
-- This test consists of the following files: |
| 34 |
-- |
| 35 |
-- F390A00.A |
| 36 |
-- => C390A030.A |
| 37 |
-- C390A031.AM |
| 38 |
-- |
| 39 |
-- |
| 40 |
-- CHANGE HISTORY: |
| 41 |
-- 06 Dec 94 SAIC ACVC 2.0 |
| 42 |
-- 04 Jun 96 SAIC ACVC 2.1: Modified prologue. |
| 43 |
-- |
| 44 |
--! |
| 45 |
|
| 46 |
with F390A00; -- Alert system abstraction. |
| 47 |
package C390A030 is |
| 48 |
|
| 49 |
|
| 50 |
type Low_Alert_Type is new F390A00.Alert_Type -- Private extension of |
| 51 |
with private; -- root tagged type. |
| 52 |
|
| 53 |
-- Inherits procedure Display from Alert_Type. |
| 54 |
|
| 55 |
procedure Handle (LA : in out Low_Alert_Type); -- Override parent's |
| 56 |
-- primitive subprog. |
| 57 |
|
| 58 |
function Level_Of (LA : in Low_Alert_Type) -- To be inherited by |
| 59 |
return Integer; -- all derivatives. |
| 60 |
|
| 61 |
|
| 62 |
-- The following two functions are needed to verify the values of the |
| 63 |
-- extension's private components. |
| 64 |
|
| 65 |
function Initial_Values_Okay (LA : in Low_Alert_Type) |
| 66 |
return Boolean; |
| 67 |
|
| 68 |
function Bad_Final_Values (LA : in Low_Alert_Type) |
| 69 |
return Boolean; |
| 70 |
|
| 71 |
|
| 72 |
-- Declarations used by private extension component. |
| 73 |
|
| 74 |
type Person_Enum is (Nobody, Duty_Officer, |
| 75 |
Watch_Commander, Commanding_Officer); |
| 76 |
|
| 77 |
|
| 78 |
type Medium_Alert_Type is new Low_Alert_Type -- Private extension of |
| 79 |
with private; -- private extension. |
| 80 |
|
| 81 |
-- Inherits (inherited) procedure Display from Low_Alert_Type. |
| 82 |
-- Inherits function Level_Of from Low_Alert_Type. |
| 83 |
|
| 84 |
procedure Handle (MA : in out Medium_Alert_Type); -- Override parent's |
| 85 |
-- primitive subprog. |
| 86 |
|
| 87 |
procedure Assign_Officer (MA : in out Medium_Alert_Type; |
| 88 |
To : in Person_Enum); |
| 89 |
|
| 90 |
|
| 91 |
-- The following two functions are needed to verify the values of the |
| 92 |
-- extension's private components. |
| 93 |
|
| 94 |
function Initial_Values_Okay (MA : in Medium_Alert_Type) |
| 95 |
return Boolean; -- Override parent's |
| 96 |
-- operation. |
| 97 |
|
| 98 |
function Bad_Final_Values (MA : in Medium_Alert_Type) |
| 99 |
return Boolean; -- Override parent's |
| 100 |
-- operation. |
| 101 |
|
| 102 |
private |
| 103 |
|
| 104 |
type Low_Alert_Type is new F390A00.Alert_Type with record |
| 105 |
Level : Integer := 0; |
| 106 |
end record; |
| 107 |
|
| 108 |
|
| 109 |
type Medium_Alert_Type is new Low_Alert_Type with record |
| 110 |
Action_Officer : Person_Enum := Nobody; |
| 111 |
end record; |
| 112 |
|
| 113 |
end C390A030; |
| 114 |
|
| 115 |
|
| 116 |
--==================================================================-- |
| 117 |
|
| 118 |
|
| 119 |
package body C390A030 is |
| 120 |
|
| 121 |
use F390A00; -- Alert system abstraction. |
| 122 |
|
| 123 |
|
| 124 |
function Level_Of (LA : in Low_Alert_Type) return Integer is |
| 125 |
begin |
| 126 |
return (LA.Level + 1); |
| 127 |
end Level_Of; |
| 128 |
|
| 129 |
|
| 130 |
procedure Handle (LA : in out Low_Alert_Type) is |
| 131 |
begin |
| 132 |
Handle (Alert_Type (LA)); -- Call parent's operation (type conversion). |
| 133 |
LA.Level := Level_Of (LA); -- Call newly declared operation. |
| 134 |
LA.Display_On := Teletype; |
| 135 |
Display (LA); -- Call inherited operation. |
| 136 |
end Handle; |
| 137 |
|
| 138 |
|
| 139 |
function Initial_Values_Okay (LA : in Low_Alert_Type) return Boolean is |
| 140 |
begin |
| 141 |
return (LA = (Arrival_Time => Default_Time, -- Check "=" operator |
| 142 |
Display_On => Null_Device, -- availability. |
| 143 |
Level => 0)); -- Aggregate with |
| 144 |
end Initial_Values_Okay; -- named associations. |
| 145 |
|
| 146 |
|
| 147 |
function Bad_Final_Values (LA : in Low_Alert_Type) return Boolean is |
| 148 |
begin |
| 149 |
return (LA /= (Alert_Time, Teletype, 1)); -- Check "/=" operator |
| 150 |
-- availability. |
| 151 |
end Bad_Final_Values; -- Aggregate with |
| 152 |
-- positional assoc. |
| 153 |
|
| 154 |
procedure Assign_Officer (MA : in out Medium_Alert_Type; |
| 155 |
To : in Person_Enum) is |
| 156 |
begin |
| 157 |
MA.Action_Officer := To; |
| 158 |
end Assign_Officer; |
| 159 |
|
| 160 |
|
| 161 |
procedure Handle (MA : in out Medium_Alert_Type) is |
| 162 |
begin |
| 163 |
Handle (Low_Alert_Type (MA)); -- Call parent's op (type conversion). |
| 164 |
MA.Level := Level_Of (MA); -- Call inherited operation. |
| 165 |
Assign_Officer (MA, Duty_Officer); -- Call newly declared operation. |
| 166 |
MA.Display_On := Console; |
| 167 |
Display (MA); -- Call twice-inherited operation. |
| 168 |
end Handle; |
| 169 |
|
| 170 |
|
| 171 |
function Initial_Values_Okay (MA : in Medium_Alert_Type) return Boolean is |
| 172 |
begin |
| 173 |
-- Call parent's operation (type conversion). |
| 174 |
return (Initial_Values_Okay (Low_Alert_Type (MA)) and |
| 175 |
MA.Action_Officer = Nobody); |
| 176 |
end Initial_Values_Okay; |
| 177 |
|
| 178 |
|
| 179 |
function Bad_Final_Values (MA : in Medium_Alert_Type) return Boolean is |
| 180 |
begin |
| 181 |
return not (MA = (Arrival_Time => Alert_Time, -- Check "=" operator |
| 182 |
Display_On => Console, -- availability. |
| 183 |
Level => 2, -- Aggregate with |
| 184 |
Action_Officer => Duty_Officer));-- named associations. |
| 185 |
end Bad_Final_Values; |
| 186 |
|
| 187 |
|
| 188 |
end C390A030; |