indexing
	description: "Instantiated commands"
	author: "Patrick Schoenbach"

class interface
	INSTANTIATED_COMMAND

create 

	make (cmd: COMMAND_BEHAVIOR)
		ensure
			command_set: command = cmd

feature -- Access

	arguments: CONTEXT

	context: CONTEXT
	
feature -- Status report

	arguments_needed: BOOLEAN
			-- Does command need arguments?

	arguments_set: BOOLEAN
			-- Are arguments set?

	clear_history: BOOLEAN
			-- Clear history after execution?

	is_executed: BOOLEAN
			-- Has command instance been executed?
			-- (from COMMAND_INSTANCE)

	is_undoable: BOOLEAN
			-- Is command instance undoable?

	valid_arguments_type (other: ANY): BOOLEAN
			-- Is arguments type valid?
	
feature -- Status setting

	set_arguments (args: CONTEXT)
			-- Set arguments of command instance.
		require -- from COMMAND_INSTANCE
			arguments_not_set: not arguments_set
		require else
			valid_type: valid_arguments_type (args)
		ensure then
			setup_complete: arguments_set
	
feature -- Basic operations

	execute
			-- Execute single command instance.
		require -- from COMMAND_INSTANCE
			not_executed: not is_executed;
			arguments_set: arguments_set
		ensure -- from COMMAND_INSTANCE
			executed: is_executed
		ensure then
			context_retrieved: not command.context_available

	redo
			-- Redo command instance.
			-- (from COMMAND_INSTANCE)

	undo
			-- Undo single command instance.
		require -- from COMMAND_INSTANCE
			undoable: is_undoable;
			executed: is_executed
		ensure -- from COMMAND_INSTANCE
			not_executed: not is_executed
		ensure then
			context_reset: context = void
	
invariant

		-- from GENERAL
	reflexive_equality: standard_is_equal (Current);
	reflexive_conformance: conforms_to (Current);
	defined_behavior: command /= void;
		-- from COMMAND_INSTANCE
	argumentless_constraint: not arguments_needed implies arguments_set;

end -- class INSTANTIATED_COMMAND