note
	description: "[
		Objects representing variables.
	]"
	author: "Andreas Leitner"
	date: "$Date: 2013-05-20 23:15:17 +0000 (Mon, 20 May 2013) $"
	revision: "$Revision: 92557 $"

class 
	ITP_VARIABLE

inherit
	ITP_EXPRESSION
		undefine
			is_equal
		end

	HASHABLE
		redefine
			is_equal
		end

create 
	make

feature {NONE} -- Initialization

	make (a_index: INTEGER_32)
			-- Create new variable with a_index.
		require
			a_index_positive: a_index > 0
		do
			index := a_index
		ensure
			index_set: index = a_index
		end
	
feature -- Access

	name (a_prefix: STRING_8): STRING_8
			-- Name of variable
			-- Return a new string every time.
		require
			a_prefix_attached: a_prefix /= Void
			not_a_prefix_is_empty: not a_prefix.is_empty
		do
			create Result.make (5)
			Result.append (a_prefix)
			Result.append (index.out)
		ensure
			result_attached: Result /= Void
			good_result: Result.is_equal (a_prefix + index.out)
		end

	hash_code: INTEGER_32
			-- Hash code value
		do
			Result := index
		ensure then
			good_result: Result = index
		end

	is_equal (other: like Current): BOOLEAN
			-- Is other attached to an object considered
			-- equal to current object?
		do
			Result := (index = other.index)
		ensure then
			good_result: Result = (index = other.index)
		end

	index: INTEGER_32
			-- Index of current variable
	
feature -- Processing

	process (a_processor: ITP_EXPRESSION_PROCESSOR)
			-- Process current expression.
		do
			a_processor.process_variable (Current)
		end
	
note
	copyright: "Copyright (c) 1984-2009, 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 ITP_VARIABLE

Generated by ISE EiffelStudio