note
	description: "[
		Objects representing delayed calls to a routine,
		with some operands possibly still open
	]"
	library: "Free implementation of ELKS library"
	status: "See notice at end of class."
	legal: "See notice at end of class."
	date: "$Date: 2017-06-01 07:24:49 +0000 (Thu, 01 Jun 2017) $"
	revision: "$Revision: 100440 $"

deferred class interface
	ROUTINE [OPEN_ARGS -> detachable TUPLE create default_create end]

feature -- Initialization

	adapt (other: like Current)
			-- Initialize from other.
			-- Useful in descendants.
		require
			other_exists: other /= Void
			conforming: conforms_to (other)
	
feature -- Access

	frozen operands: detachable OPEN_ARGS

	target: detachable ANY
			-- Target of call, if already known

	hash_code: INTEGER_32
			-- Hash code value.

	precondition (args: like operands): BOOLEAN
			-- Do args satisfy routine's precondition
			-- in current state?

	postcondition (args: like operands): BOOLEAN
			-- Does current state satisfy routine's
			-- postcondition for args?
	
feature -- Status report

	Callable: BOOLEAN = True
			-- Can routine be called on current object?

	is_equal (other: like Current): BOOLEAN
			-- Is associated routine the same as the one
			-- associated with other.

	valid_operands (args: detachable separate TUPLE): BOOLEAN
			-- Are args valid operands for this routine?

	valid_target (args: detachable TUPLE): BOOLEAN
			-- Is the first element of tuple args a valid target

	is_target_closed: BOOLEAN
			-- Is target for current agent closed, i.e. specified at creation time?
	
feature -- Measurement

	open_count: INTEGER_32
			-- Number of open operands.
	
feature -- Settings

	frozen set_operands (args: detachable OPEN_ARGS)
			-- Use args as operands for next call.
		require
			valid_operands: valid_operands (args)
		ensure
			operands_set: (operands /= Void implies (operands ~ args)) or (operands = Void implies (args = Void or else args.is_empty))

	set_target (a_target: like target)
			-- Set a_target as the next target for remaining calls to Current.
		require
			a_target_not_void: a_target /= Void
			is_target_closed: is_target_closed
			target_not_void: target /= Void
			same_target_type: attached target as t and then t.same_type (a_target)
		ensure
			target_set: target = a_target
	
feature -- Duplication

	copy (other: like Current)
			-- Use same routine as other.
		ensure then
			same_call_status: other.Callable implies Callable
	
feature -- Basic operations

	call (args: detachable separate OPEN_ARGS)
			-- Call routine with args.
		require
			valid_operands: valid_operands (args)

	apply
			-- Call routine with operands as last set.
		require
			valid_operands: valid_operands (operands)
	
feature -- Extended operations

	flexible_call (a: detachable separate TUPLE)
			-- Call routine with arguments a.
			-- Compared to call the type of a may be different from {OPEN_ARGS}.
		require
			valid_operands: valid_operands (a)
	
feature -- Correction

	correct_mismatch
			-- Attempt to correct object mismatch using Mismatch_information.
	
note
	copyright: "Copyright (c) 1984-2017, Eiffel Software and others"
	license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
	source: "[
		Eiffel Software
		5949 Hollister Ave., Goleta, CA 93117 USA
		Telephone 805-685-1006, Fax 805-685-6869
		Website http://www.eiffel.com
		Customer support http://support.eiffel.com
	]"

end -- class ROUTINE

Generated by ISE EiffelStudio