indexing description: "" legal: "See notice at end of class." status: "See notice at end of class." date: "$Date$" revision: "$Revision$" class JAVA_STRING_ARRAY inherit JAVA_ARRAY create make, make_from_array, 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 local element_type: JAVA_CLASS do element_type := jni.find_class ("java/lang/String") jarray := jni.new_object_array (size, element_type.java_class_id, default_pointer) create jvalue.make ensure array_ok: jarray /= default_pointer end make_from_array (an_array: ARRAY[STRING]) is -- local i, i1: INTEGER do make (an_array.count); from i := an_array.lower i1 := 0 until i > an_array.upper loop put (an_array.item (i), i1) i := i+1 i1 := i1+1 end end feature -- Access item (index: INTEGER): STRING is -- object at index-th position require valid_index: valid_index (index) local jo: POINTER do jo := jni.get_object_array_element (jarray, index) -- Find the correspponding Eiffel object or create a new one if jo /= default_pointer then Result := jni.get_string (jo) end end feature -- Element change put (an_item: STRING; index: INTEGER) is -- put an object at index require valid_index: valid_index (index) do jni.set_object_array_element (jarray, index, jni.new_string (an_item)) ensure inserted: equal (item (index), an_item) end indexing library: "egigs-jni: Library for accessing the GigaSpaces platform, JNI based implementation." copyright: "Copyright (c) 2008, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" source: "[ Eiffel Software 356 Storke Road, Goleta, CA 93117 USA Telephone 805-685-1006, Fax 805-685-6869 Website http://www.eiffel.com Customer support http://support.eiffel.com ]" end