indexing
	description: "Argument list for calls to Java methods"

class interface
	JAVA_ARGS

create 

	make (ncount: INTEGER)
			-- make an argument list for at most "ncount" arguments
		require
			ncount >= 1
		ensure
			java_args_array /= default_pointer
			count = ncount

feature -- Access

	C_memory: INTEGER is 2
			-- Code for the C memory managed
			-- by the garbage collector
			-- (from MEM_CONST)

	Eiffel_memory: INTEGER is 1
			-- Code for the Eiffel memory managed
			-- by the garbage collector
			-- (from MEM_CONST)

	Full_collector: INTEGER is 0
			-- Statistics for full collections
			-- (from MEM_CONST)

	Incremental_collector: INTEGER is 1
			-- Statistics for incremental collections
			-- (from MEM_CONST)

	Total_memory: INTEGER is 0
			-- Code for all the memory managed
			-- by the garbage collector
			-- (from MEM_CONST)
	
feature -- Measurement

	gc_statistics (collector_type: INTEGER): GC_INFO
			-- Garbage collection information for collector_type.
			-- (from MEMORY)
		require -- from MEMORY
			type_ok: collector_type = full_collector or collector_type = incremental_collector

	memory_statistics (memory_type: INTEGER): MEM_INFO
			-- Memory usage information for memory_type
			-- (from MEMORY)
		require -- from MEMORY
			type_ok: memory_type = total_memory or memory_type = eiffel_memory or memory_type = c_memory
	
feature -- Status report

	chunk_size: INTEGER
			-- Minimal size of a memory chunk. The run-time always
			-- allocates a multiple of this size.
			-- If the environment variable EIF_MEMORY_CHUNK
			-- is defined, it is set to the closest reasonable
			-- value from it.
			-- (from MEMORY)

	coalesce_period: INTEGER
			-- Period of full coalesce (in number of collections)
			-- If the environment variable EIF_FULL_COALESCE_PERIOD
			-- is defined, it is set to the closest reasonable
			-- value from it.
			-- If null, no full coalescing is launched.
			-- (from MEMORY)

	collecting: BOOLEAN
			-- Is garbage collection enabled?
			-- (from MEMORY)

	collection_period: INTEGER
			-- Period of full collection.
			-- If the environment variable EIF_FULL_COLLECTION_PERIOD
			-- is defined, it is set to the closest reasonable
			-- value from it.
			-- If null, no full collection is launched.
			-- (from MEMORY)

	generation_object_limit: INTEGER
			-- Maximum size of object in generational scavenge zone.
			-- If the environment variable EIF_GS_LIMIT
			-- is defined, it is set to the closest reasonable
			-- value from it.
			-- (from MEMORY)

	is_in_final_collect: BOOLEAN
			-- Is GC currently performing final collection
			-- after execution of current program?
			-- Safe to use in dispose.
			-- (from MEMORY)

	largest_coalesced_block: INTEGER
			-- Size of largest coalesced block since last call to
			-- largest_coalesced; 0 if none.
			-- (from MEMORY)

	max_mem: INTEGER
			-- Maximum amount of bytes the run-time can allocate.
			-- (from MEMORY)

	memory_threshold: INTEGER
			-- Minimum amount of bytes to be allocated before
			-- starting an automatic garbage collection.
			-- (from MEMORY)

	referers (an_object: ANY): ARRAY [ANY]
			-- Objects that refer to an_object.
			-- (from MEMORY)

	scavenge_zone_size: INTEGER
			-- Size of generational scavenge zone.
			-- If the environment variable EIF_MEMORY_SCAVENGE
			-- is defined, it is set to the closest reasonable
			-- value from it.
			-- (from MEMORY)

	tenure: INTEGER
			-- Maximum age of object before being considered
			-- as old (old objects are not scanned during
			-- partial collection).
			-- If the environment variable EIF_TENURE_MAX
			-- is defined, it is set to the closest reasonable
			-- value from it.
			-- (from MEMORY)
	
feature -- Status setting

	allocate_compact
			-- Enter `memory' mode: will try to compact memory
			-- before requesting more from the operating system.
			-- (from MEMORY)

	allocate_fast
			-- Enter `speed' mode: will optimize speed of memory
			-- allocation rather than memory usage.
			-- (from MEMORY)

	allocate_tiny
			-- Enter `tiny' mode: will enter `memory' mode
			-- after having freed as much memory as possible.
			-- (from MEMORY)

	collection_off
			-- Disable garbage collection.
			-- (from MEMORY)

	collection_on
			-- Enable garbage collection.
			-- (from MEMORY)

	disable_time_accounting
			-- Disable GC time accounting (default).
			-- (from MEMORY)

	enable_time_accounting
			-- Enable GC time accouting, accessible in gc_statistics.
			-- (from MEMORY)

	set_coalesce_period (value: INTEGER)
			-- Set coalesce_period. Every value collection,
			-- the Garbage Collector will coalesce
			-- the whole memory.
			-- (from MEMORY)
		require -- from MEMORY
			positive_value: value >= 0

	set_collection_period (value: INTEGER)
			-- Set collection_period. Every value collection,
			-- the Garbage collector will perform a collection
			-- on the whole memory (full collection), otherwise
			-- a simple partial collection is done.
			-- (from MEMORY)
		require -- from MEMORY
			positive_value: value >= 0

	set_max_mem (value: INTEGER)
			-- Set the maximum amount of memory the run-time can allocate.
			-- (from MEMORY)
		require -- from MEMORY
			positive_value: value > 0

	set_memory_threshold (value: INTEGER)
			-- Set a new memory_threshold in bytes. Whenever the memory
			-- allocated for Eiffel reaches this value, an automatic
			-- collection is performed.
			-- (from MEMORY)
		require -- from MEMORY
			positive_value: value > 0
	
feature -- Removal

	collect
			-- Force a partial collection cycle if garbage
			-- collection is enabled; do nothing otherwise.
			-- (from MEMORY)

	free (object: ANY)
			-- Free object, by-passing garbage collection.
			-- Erratic behavior will result if the object is still
			-- referenced.
			-- (from MEMORY)

	full_coalesce
			-- Coalesce the whole memory: merge adjacent free
			-- blocks to reduce fragmentation. Useful, when
			-- a lot of memory is allocated with garbage collector off.
			-- (from MEMORY)

	full_collect
			-- Force a full collection cycle if garbage
			-- collection is enabled; do nothing otherwise.
			-- (from MEMORY)

	mem_free (addr: POINTER)
			-- Free memory of object at addr.
			-- (Preferred interface is free.)
			-- (from MEMORY)
	
feature 

	count: INTEGER
			-- number of positions in the arg list

	full: BOOLEAN
			-- true if argument list is full

	jni: JNI_ENVIRONMENT
			-- returns the standard JNI enviroment. It uses the value of
			-- CLASS_PATH environment variable to initialize the JVM
			-- (from SHARED_JNI_ENVIRONMENT)
		ensure -- from SHARED_JNI_ENVIRONMENT
			Result /= void

	make (ncount: INTEGER)
			-- make an argument list for at most "ncount" arguments
		require
			ncount >= 1
		ensure
			java_args_array /= default_pointer
			count = ncount

	push_array (value: JAVA_ARRAY)
			-- add a "array" argument (Void allowed)
		require
			not full

	push_boolean (value: BOOLEAN)
			-- add a "boolean" argment
		require
			not full

	push_char (value: CHARACTER)
			-- add a "character" argument
		require
			not full

	push_double (value: DOUBLE)
			-- add a "double" argument
		require
			not full

	push_float (value: REAL)
			-- add a "float" argument
		require
			not full

	push_int (value: INTEGER)
			-- add "integer" argument
		require
			not full

	push_object (value: JAVA_OBJECT)
			-- add an "object" argument (Void allowed)
		require
			not full

	push_short (value: INTEGER)
			-- add a "short" argument
		require
			not full

	push_string (value: STRING)
			-- add "string" argument
		require
			not full

	reset
			-- reset the argument list
	
invariant

		-- from ANY
	reflexive_equality: standard_is_equal (Current)
	reflexive_conformance: conforms_to (Current)

end -- class JAVA_ARGS