DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ G T

⟦883992960⟧ TextFile

    Length: 4398 (0x112e)
    Types: TextFile
    Names: »GOAL_B«

Derivation

└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
    └─ ⟦129cab021⟧ »DATA« 
        └─⟦this⟧ 
└─⟦f64eaa120⟧ Bits:30000752 8mm tape, Rational 1000, !projects 93 02 16
    └─ ⟦6f12a12be⟧ »DATA« 
        └─⟦this⟧ 
└─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04
    └─ ⟦d65440be7⟧ »DATA« 
        └─⟦this⟧ 

TextFile


with physicalObject;
package body goal is

   package behaviour is new classBehavior(object,"GOALS     ");

   procedure make       (status        : goal_state;
			 goal_type     : g_type;
			 name	       : physical_object;
			 go_to	       : coordinate) is
      the_goal : goal.object;
   begin
      the_goal.status    := status;
      the_goal.goal_type := goal_type;
      the_goal.name      := name;
      the_goal.go_to     := go_to;

      if the_goal.goal_type = holds and the_goal.name /= nil then
	 declare
	    obj : reference;

            function light_object(an_object : reference) return boolean is
            begin
               return 
                  physicalObject.name(an_object) = the_goal.name	and then
		  physicalObject.weight(an_object) = light;
            end light_object;

            function find_an_object is new collection.findOne(light_object);
	 begin
  	    obj := find_an_object(physicalObject.instances);
	    if collection.isNull(obj) then
	       raise illegal_make;
	    end if;
         end;
      end if;

      if the_goal.goal_type = is_on and the_goal.name /= floor then
	 declare
	    obj : reference;

            function climb_on(an_object : reference) return boolean is
            begin
               return 
                  physicalObject.name(an_object) = the_goal.name;
            end climb_on;

            function find_an_object is new collection.findOne(climb_on);
	 begin
  	    obj := find_an_object(physicalObject.instances);
	    if collection.isNull(obj) then
	       raise illegal_make;
	    end if;
         end;
      end if;

      if the_goal.goal_type = is_at and the_goal.name /= nil then
	 declare
	    obj : reference;

            function move(an_object : reference) return boolean is
            begin
               return 
                  physicalObject.name(an_object) = the_goal.name;
            end move;

            function find_an_object is new collection.findOne(move);
	 begin
  	    obj := find_an_object(physicalObject.instances);
	    if collection.isNull(obj) then
	       raise illegal_make;
	    end if;
         end;
      end if;

      behaviour.allocate(the_goal);
   end make;

   function status      (the_reference : in expertSystem.reference)
                       return goal_state is
   begin
      return behaviour.get(the_reference).status;
   end status;

   function goal_type   (the_reference : in expertSystem.reference)
		       return g_type is
   begin
      return behaviour.get(the_reference).goal_type;
   end goal_type;

   function object_name (the_reference : in expertSystem.reference)
                       return physical_object is
   begin
      return behaviour.get(the_reference).name;
   end object_name;

   function go_to       (the_reference : in expertSystem.reference)
                       return coordinate is
   begin
      return behaviour.get(the_reference).go_to;
   end go_to;

   procedure modify_status      (the_reference  : in expertSystem.reference;
		                 new_status     : in goal_state) is
      the_object : object;
   begin
      the_object := behaviour.get(the_reference);
      the_object.status := new_status;
      behaviour.set(the_reference, the_object);
   end modify_status;

   procedure modify_goal_type   (the_reference  : in expertSystem.reference;
				 new_type       : in g_type) is
      the_object : object;
   begin
      the_object := behaviour.get(the_reference);
      the_object.goal_type := new_type;
      behaviour.set(the_reference, the_object);
   end modify_goal_type;

   procedure modify_object_name (the_reference  : in expertSystem.reference;
				 new_object     : in physical_object) is
      the_object : object;
   begin
      the_object := behaviour.get(the_reference);
      the_object.name := new_object;
      behaviour.set(the_reference, the_object);
   end modify_object_name;

   procedure modify_go_to       (the_reference  : in expertSystem.reference;
				 new_location   : in coordinate) is
      the_object : object;
   begin
      the_object := behaviour.get(the_reference);
      the_object.go_to := new_location;
      behaviour.set(the_reference, the_object);
   end modify_go_to;

   function instances return collection.object is
   begin
      return behaviour.instances;
   end instances;

   procedure clear is
   begin
      behaviour.clear;
   end clear;

end goal;