class interface POINT

creation
   make
      --  Create.

      ensure
         ok: is_origin

   make_coord (ex, ey: INTEGER)
      --  Create from coordinates.

      ensure
         done: x = ex and y = ey

   from_string (str: STRING)
      --  Init object from string.

      require
         valid: str /= Void
      ensure
         done:  --  success implies to_string.is_equal(str)

feature(s) from P_TEXT_OBJECT
   --  Public interface

   to_string: STRING
      ensure
         is_copy: Result /= Void

   from_string (str: STRING)
      --  Init object from string.

      require
         valid: str /= Void
      ensure
         done:  --  success implies to_string.is_equal(str)

feature(s) from POINT
   out: STRING
      --  String representation.


feature(s) from POINT
   --  Actual coordinates

   x: INTEGER

feature(s) from POINT
   --  Actual coordinates

   y: INTEGER

feature(s) from POINT
   --  Set point coordinates

   set_x (xc: INTEGER)
      --  Set the horizontal coordinate.


   set_y (yc: INTEGER)
      --  Set the vertical coordinate.


feature(s) from POINT
   --  Helper procedures

   set_xy (cx, cy: INTEGER)
      --  Set both coordinates.


feature(s) from POINT
   --  Point operations

   is_origin: BOOLEAN
      --  Is the point the origin (0, 0)?


   is_less_horizontally (other: POINT): BOOLEAN
      ensure
         done: Result = (x <= other.x)

   is_less_vertically (other: POINT): BOOLEAN
      ensure
         done: Result = (y <= other.y)

   is_less (other: POINT): BOOLEAN
      ensure
         done: Result = (is_less_horizontally(other) and then is_less_vertically(other))


end of POINT