comp.lang.ada
 help / color / mirror / Atom feed
* Hi all. Novice question.
@ 1999-09-04  0:00 G
  1999-09-04  0:00 ` Matthew Heaney
  1999-09-07  0:00 ` Hi all. Novice question Nick Roberts
  0 siblings, 2 replies; 7+ messages in thread
From: G @ 1999-09-04  0:00 UTC (permalink / raw)


I made the regrettable mistake of posting a message here about a year
ago whilst
I may have been a little intoxicated.

Ever since, all my messages are deleted by some automated process set up
by the
webmaster/sysop.  So... I still have questions and I will try to ask
them.

I am interested in designing simulations.  I have a philosophical
interest in ontology (the study of being and existence) and I believe
that this relates to entities and objects in programming.  I am using
things like ada and xml to elaborate other concepts - the structures of
the languages help with organisation of ideas, etc.  The XMLspy editor
is great for playing with design concepts and ada is useful to elaborate
a logical structure even if it is not going to be employed in an actual
program.

I am a novice... so please do not shoot me down in flames for doing
something
completely anathema to ada principles .

I got the M1A2 specifications from army-technology.com so don't wet
yourself if you think
I shouldn't write it here.  (Someone noted previously something of a
"precious" atmosphere here at times).

Anyway - I wanted to try and delineate an "object".  This was written
over a half-hour period and as a novice I still understand little of ada
but can anyone tell me if it makes sense to define an object like this.
I realise that there are many issues with
type definition and which variables should be constant but I just want
to know if it makes sense to define something this way - it compiles
fine on GNAT.  I also realise that many of the variables in this sort of
thing would be of types in external packages -
but I am a novice, in this field at least.  I have no idea if making
this type (M1A2_Abrams) private means that it could not
be instantiated in a program.  I have not got that far.

It is not supposed to be a credible package definition, just a
(relatively) sensible one.


This (Ada95) package spec and body:

-----------------------------

   package M1A2_Abrams is

      private type M1A2_Abrams;

   end M1A2_Abrams;

-------------------------------

package body M1a2_Abrams is

   type Physical_Specification is new Float;

   type Weapon_Specification is (M256_120_00mm_Smooth_Bore_Cannon,
      M240_7_62mm_Machine_Gun, M240_7_62mm_Machine_Gun_Skate_Mount,
      M2_0_50mm_Machine_Gun);

   type Mobility_Specification is new Float;

   type Engine is (Gas_Turbine);

   type Transmission is (Hydro_Kinetic);

   type Misc_Parameters is (Nbc_System);

   type Crew is new Integer;

   -- Type => M1a2 Abrams
   type M1a2_Abrams is
   record
      -- Type => Physical_Specification.
      Weight : Physical_Specification := 69.54;             -- tons
      Length_Gun_Forward : Physical_Specification := 387.0; -- inches
      Turret_Height : Physical_Specification := 93.5;       --
      Width : Physical_Specification := 144.0;              --
      Ground_Pressure : Physical_Specification := 15.4;     -- PSI
      Power_Weight_Ratio : Physical_Specification := 21.6;  -- hp/ton

      -- Type => Weapon_Specification.
      Main_Armament : Weapon_Specification :=
M256_120_00mm_Smooth_Bore_Cannon; -- 120 mm
      Coaxial_Weapon : Weapon_Specification :=
M240_7_62mm_Machine_Gun;         -- 7.62 mm
      Loaders_Weapon : Weapon_Specification :=
M240_7_62mm_Machine_Gun_Skate_Mount;
      Commanders_Weapon : Weapon_Specification :=
M2_0_50mm_Machine_Gun;        -- .50 mm

      -- Type => Mobility_Specification.
      -- Conversion to metric pending.
      Maximum_Speed : Mobility_Specification := 42.0;        -- 42.0 mph
(Governed)
      Cross_Country_Speed : Mobility_Specification := 30.0;  -- mph
      Speed_10pc_Slope : Mobility_Specification := 17.0;     -- mph
      Speed_60pc_Slope : Mobility_Specification := 4.1;      -- mph
      Acceleration_0_To_20 : Mobility_Specification := 7.2;  -- seconds
      Cruising_Range : Mobility_Specification := 265.0;      -- miles
      Obstacle_Crossing : Mobility_Specification := 42.0;    -- inches
      Vertical_Trench : Mobility_Specification := 9.0;       -- feet

      -- Type => Engine.
      M1a2_Engine : Engine := Gas_Turbine;


      -- Type => Transmission.
      M1a2_Transmission : Transmission := Hydro_Kinetic;

      -- Type => Misc_Parameters.
      M1a2_Air_Control : Misc_Parameters := Nbc_System;  -- Clean,
cooled air

      -- Type => Crew.
      M1a2_Crew : Crew := 4;

   end record;


end M1a2_Abrams;


------------------------------



-- I am teaching myself this stuff, so understand that before you grill
me.
-- Any feedback is useful.  Can an object be defined as a record like
this and
-- does it make sense to do so (?).



-- GM WALLACE
-- (does volunteer work online for welfare organisations)
-- AUSTRALIA





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~1999-09-08  0:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-09-04  0:00 Hi all. Novice question G
1999-09-04  0:00 ` Matthew Heaney
1999-09-07  0:00   ` Idiots (was Re: Hi all. Novice question.) Mark Lundquist
1999-09-08  0:00     ` Marin David Condic
1999-09-07  0:00 ` Hi all. Novice question Nick Roberts
1999-09-08  0:00   ` Hi all. Novice question. from an idiot G
1999-09-08  0:00     ` Preben Randhol

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox