indexing description: "Access to Java array of 'long'" date: "$Date$" revision: "$Revision$" class JAVA_LONG_ARRAY inherit JAVA_ARRAY create make, make_from_pointer feature -- Initialization make (size: INTEGER) is -- Create a new Java array and an Eiffel accessor object -- Note: Java arrays are indexed from zero require size_ok: size > 0 do jarray := jni.new_long_array (size) create jvalue.make ensure array_ok: jarray /= default_pointer end feature -- Access item (index: INTEGER): INTEGER_64 is -- Item at `index'. require valid_index: valid_index (index) local l_array_ptr: POINTER do l_array_ptr := jni.get_long_array_elements (jarray, default_pointer) jvalue.make_by_pointer (l_array_ptr + index * sizeof_jlong) Result := jvalue.long_value jni.release_long_array_elements (jarray, l_array_ptr, 0) end feature -- Element change put (an_item: INTEGER_64; index: INTEGER) is -- Put `an_item' at `index'. require valid_index: valid_index (index) local l_array_ptr: POINTER do l_array_ptr := jni.get_long_array_elements (jarray, default_pointer) jvalue.make_by_pointer (l_array_ptr + index * sizeof_jlong) jvalue.set_long_value (an_item) jni.release_long_array_elements (jarray, l_array_ptr, 0) ensure inserted: item (index) = an_item end end --|---------------------------------------------------------------- --| Eiffel2Java: library of reusable components for ISE Eiffel. --| Copyright (C) 1986-2001 Interactive Software Engineering Inc. --| All rights reserved. Duplication and distribution prohibited. --| May be used only with ISE Eiffel, under terms of user license. --| Contact ISE for any other use. --| --| Interactive Software Engineering Inc. --| ISE Building --| 360 Storke Road, Goleta, CA 93117 USA --| Telephone 805-685-1006, Fax 805-685-6869 --| Electronic mail --| Customer support: http://support.eiffel.com> --| For latest info see award-winning pages: http://www.eiffel.com --|----------------------------------------------------------------