" " + name + " changes position from " + position + " to " + a_position + ".%N") position := a_position ensure position_set: position.same_string (a_position) end feature {NONE} -- Implementation encounter (a_sensor_agent: FUNCTION [ANY, TUPLE, attached like sensor_data_anchor]) -- Detect and report on collision status of Current with `a_radar_agent'. do a_sensor_agent.call ([Void]) check attached {like sensor_data_anchor} a_sensor_agent.last_result as al_sensor_data then if not name.same_string (al_sensor_data.name) then if (position.same_string (al_sensor_data.position)) then if ((al_sensor_data.is_dockable and is_dockable) and (is_manned and al_sensor_data.is_manned) and (is_manueverable and al_sensor_data.is_not_manueverable)) then print (type + " " + name + " is near " + al_sensor_data.type + " " + al_sensor_data.name + " and is dockable.%N") elseif ((is_dockable and al_sensor_data.is_dockable) and (is_manned and al_sensor_data.is_manned) and (is_manueverable and al_sensor_data.is_manueverable)) then print (type + " " + name + " beams a science team to " + al_sensor_data.type + " " + al_sensor_data.name + " as they pass!%N") elseif (is_manned and al_sensor_data.is_not_manned) then print (type + " " + name + " takes evasive action, avoiding " + al_sensor_data.type + " `" + al_sensor_data.name + "'!%N") end end end end end name: STRING -- Name of Current. type: STRING -- Type of Current. deferred end position: STRING -- Position of Current. is_dockable: BOOLEAN -- Is Current dockable with another manned object? deferred end is_manned: BOOLEAN -- Is Current a manned object? deferred end is_manueverable: BOOLEAN -- Is Current capable of being moved? deferred end sensor_data: attached like sensor_data_anchor -- Sensor data of Current. do Result := [name, type, position, is_dockable, not is_dockable, is_manned, not is_manned, is_manueverable, not is_manueverable] end sensor_data_anchor: detachable TUPLE [name, type, position: STRING; is_dockable, is_not_dockable, is_manned, is_not_manned, is_manueverable, is_not_manueverable: BOOLEAN] -- Sensor data type anchor of Current. end There are three descendant classes of SPACE_OBJECT: SPACE_OBJECT ASTEROID SPACESHIP SPACESTATION In our example, the ASTEROID class is used for the `Rogue' items, SPACESHIP for the two star ships and SPACESTATION for Deep Space Nine. In each class, the only specialization is the setting of the `type' feature and of certain properties of the object. The `name' is supplied in the creation routine as well as the `position'. For example: Below is the SPACESHIP example. class SPACESHIP inherit SPACE_OBJECT create make_with_name feature {NONE} -- Implementation type: STRING = "Starship" -- <Precursor> is_dockable: BOOLEAN = True -- <Precursor> is_manned: BOOLEAN = True -- <Precursor> is_manueverable: BOOLEAN = True -- <Precursor> end So, any SPACESHIP in our universe is dock-able, manned