/[eiffelstudio]/trunk/Src/library/Eiffel2Java/java_object_table.e
ViewVC logotype

Contents of /trunk/Src/library/Eiffel2Java/java_object_table.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 33621 - (show annotations)
Tue Aug 13 15:43:39 2002 UTC (17 years, 6 months ago) by manus
File size: 1890 byte(s)
Cosmetics.
Added more contracts.

1 indexing
2 description: "This class provides a mapping between Java and Eiffel objects"
3 date: "$Date$"
4 revision: "$Revision$"
5
6 class JAVA_OBJECT_TABLE
7
8 create
9 make
10
11 feature {NONE} -- Initialization
12
13 make is
14 -- create a table for Eiffel proxies of Java object
15 do
16 create table.make (511)
17 end
18
19 feature -- Access
20
21 item (jobject: POINTER): JAVA_OBJECT is
22 -- find a Eiffel proxy for an Java object
23 require
24 jobject_not_void: jobject /= default_pointer
25 do
26 Result := table.item (jobject)
27 end
28
29 feature -- Element change
30
31 put (object: JAVA_OBJECT) is
32 -- Add a new object to the table
33 require
34 jobject_not_void: object /= Void
35 jobject_alive: object.exists
36 local
37 it: JAVA_OBJECT
38 ex: EXCEPTIONS
39 do
40 it := table.item (object.java_object_id)
41 if it = Void then
42 table.put (object, object.java_object_id)
43 elseif (it /= object) then
44 create ex
45 ex.raise ("Attempted to insert duplicate Eiffel object")
46 end
47 ensure
48 inserted: table.has (object.java_object_id)
49 end
50
51 feature {NONE}
52
53 table: HASH_TABLE [JAVA_OBJECT, POINTER]
54 -- table of objects
55
56 invariant
57 table_not_void: table /= Void
58
59 end
60
61 --|----------------------------------------------------------------
62 --| Eiffel2Java: library of reusable components for ISE Eiffel.
63 --| Copyright (C) 1986-2001 Interactive Software Engineering Inc.
64 --| All rights reserved. Duplication and distribution prohibited.
65 --| May be used only with ISE Eiffel, under terms of user license.
66 --| Contact ISE for any other use.
67 --|
68 --| Interactive Software Engineering Inc.
69 --| ISE Building
70 --| 360 Storke Road, Goleta, CA 93117 USA
71 --| Telephone 805-685-1006, Fax 805-685-6869
72 --| Electronic mail <info@eiffel.com>
73 --| Customer support: http://support.eiffel.com>
74 --| For latest info see award-winning pages: http://www.eiffel.com
75 --|----------------------------------------------------------------
76

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23