-- -*- Mode: Sather;  -*-
-- File: abstract_ocean.sa
-- Author: Chu-Cheow Lim (clim@ICSI.Berkeley.EDU)
-- Copyright (C) International Computer Science Institute, 1993
--
-- COPYRIGHT NOTICE: This code is provided "AS IS" WITHOUT ANY WARRANTY
-- and is subject to the terms of the SATHER LIBRARY GENERAL PUBLIC
-- LICENSE contained in the file: "sather/doc/license.txt" of the Sather
-- distribution. The license is also available from ICSI, 1947 Center
-- St., Suite 600, Berkeley CA 94704, USA.
--*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--* FUNCTION:
--*
--* CLASSES:
--* 
--* REQUIRED FILES:
--*
--* RELATED FILES:
--*
--* HISTORY:
--* Last edited: Jun  1 16:17 1993 (clim)
--* Created: Fri May 28 17:48:32 1993 (clim)
--*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

class ABSTRACT_OCEAN{T} is
   -- Serves as the abstract class $OCEAN{T}, inherited by both OCEAN{T} and
   -- DIST_VERT_OCEAN{T}.  In old Sather, the user declares $ABSTRACT_OCEAN,
   -- but never creates a reference object of this type.

   -- Abstract interface.
   get(x,y:INT):T is end;
   test(x,y:INT):BOOL is end;
   insert(x,y:INT; e:T) is end;
   delete(x,y:INT) is end;
   difference_with(x:$SELF_TYPE):$SELF_TYPE is end;
   union_with(x:$SELF_TYPE):$SELF_TYPE is end;

   discrete_dir(c:COMPLEX):INT is end;
   update_x_dir(pos:INT; dir:INT):INT is end;
   update_y_dir(pos:INT; dir:INT):INT is end;

   up_of(y_pos:INT):INT is end;
   down_of(y_pos:INT):INT is end;
   left_of(x_pos:INT):INT is end;
   right_of(x_pos:INT):INT is end;

   -- Abstract interface of the distributed nature of OCEAN.
   cluster_id_of(x,y:INT):INT is end;

end; -- class ABSTRACT_OCEAN

--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

class ABSTRACT_OCEAN_OF_PREDATORS is
   -- Serves as abstract class $ABSTRACT_OCEAN_OF_PREDATOR, inherited by both
   -- OCEAN_OF_PREDATOR and DIST_OCEAN_OF_PREDATOR (type inheritance).
   ABSTRACT_OCEAN{$ABSTRACT_CREATURE};

   repel_prey(x,y:DOUBLE):COMPLEX is end;
   -- Given the position of prey, compute the force that repels it (from
   -- all the predators).

end; -- class ABSTRACT_OCEAN_OF_PREDATORS

--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

class ABSTRACT_OCEAN_OF_PREY is
   -- Serves as abstract class $ABSTRACT_OCEAN_OF_PREY, inherited by both
   -- OCEAN_OF_PREY and DIST_OCEAN_OF_PREY.
   ABSTRACT_OCEAN{$ABSTRACT_CREATURE};

   attract_predator(x,y:DOUBLE):COMPLEX is end;
   -- Given the position of predator, compute the force that attracts it (by
   -- all the prey).

end; -- class ABSTRACT_OCEAN_OF_PREY

--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~