Mercurial > hg > graal-compiler
annotate graal/com.oracle.truffle.api.object/src/com/oracle/truffle/api/object/DynamicObject.java @ 21652:5f3dda39d205
Truffle: add DynamicObject#containsKey, make flags parameter optional, minor simplifications
author | Andreas Woess <andreas.woess@oracle.com> |
---|---|
date | Mon, 01 Jun 2015 12:55:56 +0200 |
parents | 723142fed324 |
children |
rev | line source |
---|---|
18407
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
1 /* |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
2 * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
4 * |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. Oracle designates this |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
8 * particular file as subject to the "Classpath" exception as provided |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
9 * by Oracle in the LICENSE file that accompanied this code. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
10 * |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
11 * This code is distributed in the hope that it will be useful, but WITHOUT |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
14 * version 2 for more details (a copy is included in the LICENSE file that |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
15 * accompanied this code). |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
16 * |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU General Public License version |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
18 * 2 along with this work; if not, write to the Free Software Foundation, |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
20 * |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
22 * or visit www.oracle.com if you need additional information or have any |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
23 * questions. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
24 */ |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
25 package com.oracle.truffle.api.object; |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
26 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
27 import com.oracle.truffle.api.*; |
18747
6db7923af642
OM: DynamicObject extends TruffleObject, add default implementation
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
18407
diff
changeset
|
28 import com.oracle.truffle.api.interop.*; |
18407
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
29 |
19336
723142fed324
Change DynamicObject from an interface to an abstract class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18747
diff
changeset
|
30 public abstract class DynamicObject implements TypedObject, TruffleObject { |
18407
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
31 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
32 * Get the object's current shape. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
33 */ |
19336
723142fed324
Change DynamicObject from an interface to an abstract class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18747
diff
changeset
|
34 public abstract Shape getShape(); |
18407
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
35 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
36 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
37 * Get property value. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
38 * |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
39 * @param key property identifier |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
40 * @param defaultValue return value if property is not found |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
41 * @return property value or defaultValue if object has no such property |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
42 */ |
19336
723142fed324
Change DynamicObject from an interface to an abstract class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18747
diff
changeset
|
43 public abstract Object get(Object key, Object defaultValue); |
18407
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
44 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
45 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
46 * Set value of existing property. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
47 * |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
48 * @param key property identifier |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
49 * @param value value to be set |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
50 * @return {@code true} if successful or {@code false} if property not found |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
51 */ |
19336
723142fed324
Change DynamicObject from an interface to an abstract class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18747
diff
changeset
|
52 public abstract boolean set(Object key, Object value); |
18407
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
53 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
54 /** |
21652
5f3dda39d205
Truffle: add DynamicObject#containsKey, make flags parameter optional, minor simplifications
Andreas Woess <andreas.woess@oracle.com>
parents:
19336
diff
changeset
|
55 * Returns {@code true} if this object contains a property with the given key. |
5f3dda39d205
Truffle: add DynamicObject#containsKey, make flags parameter optional, minor simplifications
Andreas Woess <andreas.woess@oracle.com>
parents:
19336
diff
changeset
|
56 */ |
5f3dda39d205
Truffle: add DynamicObject#containsKey, make flags parameter optional, minor simplifications
Andreas Woess <andreas.woess@oracle.com>
parents:
19336
diff
changeset
|
57 public final boolean containsKey(Object key) { |
5f3dda39d205
Truffle: add DynamicObject#containsKey, make flags parameter optional, minor simplifications
Andreas Woess <andreas.woess@oracle.com>
parents:
19336
diff
changeset
|
58 return getShape().getProperty(key) != null; |
5f3dda39d205
Truffle: add DynamicObject#containsKey, make flags parameter optional, minor simplifications
Andreas Woess <andreas.woess@oracle.com>
parents:
19336
diff
changeset
|
59 } |
5f3dda39d205
Truffle: add DynamicObject#containsKey, make flags parameter optional, minor simplifications
Andreas Woess <andreas.woess@oracle.com>
parents:
19336
diff
changeset
|
60 |
5f3dda39d205
Truffle: add DynamicObject#containsKey, make flags parameter optional, minor simplifications
Andreas Woess <andreas.woess@oracle.com>
parents:
19336
diff
changeset
|
61 /** |
5f3dda39d205
Truffle: add DynamicObject#containsKey, make flags parameter optional, minor simplifications
Andreas Woess <andreas.woess@oracle.com>
parents:
19336
diff
changeset
|
62 * Define new property or redefine existing property. |
5f3dda39d205
Truffle: add DynamicObject#containsKey, make flags parameter optional, minor simplifications
Andreas Woess <andreas.woess@oracle.com>
parents:
19336
diff
changeset
|
63 * |
5f3dda39d205
Truffle: add DynamicObject#containsKey, make flags parameter optional, minor simplifications
Andreas Woess <andreas.woess@oracle.com>
parents:
19336
diff
changeset
|
64 * @param key property identifier |
5f3dda39d205
Truffle: add DynamicObject#containsKey, make flags parameter optional, minor simplifications
Andreas Woess <andreas.woess@oracle.com>
parents:
19336
diff
changeset
|
65 * @param value value to be set |
5f3dda39d205
Truffle: add DynamicObject#containsKey, make flags parameter optional, minor simplifications
Andreas Woess <andreas.woess@oracle.com>
parents:
19336
diff
changeset
|
66 */ |
5f3dda39d205
Truffle: add DynamicObject#containsKey, make flags parameter optional, minor simplifications
Andreas Woess <andreas.woess@oracle.com>
parents:
19336
diff
changeset
|
67 public final void define(Object key, Object value) { |
5f3dda39d205
Truffle: add DynamicObject#containsKey, make flags parameter optional, minor simplifications
Andreas Woess <andreas.woess@oracle.com>
parents:
19336
diff
changeset
|
68 define(key, value, 0); |
5f3dda39d205
Truffle: add DynamicObject#containsKey, make flags parameter optional, minor simplifications
Andreas Woess <andreas.woess@oracle.com>
parents:
19336
diff
changeset
|
69 } |
5f3dda39d205
Truffle: add DynamicObject#containsKey, make flags parameter optional, minor simplifications
Andreas Woess <andreas.woess@oracle.com>
parents:
19336
diff
changeset
|
70 |
5f3dda39d205
Truffle: add DynamicObject#containsKey, make flags parameter optional, minor simplifications
Andreas Woess <andreas.woess@oracle.com>
parents:
19336
diff
changeset
|
71 /** |
18407
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
72 * Define new property or redefine existing property. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
73 * |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
74 * @param key property identifier |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
75 * @param value value to be set |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
76 * @param flags flags to be set |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
77 */ |
19336
723142fed324
Change DynamicObject from an interface to an abstract class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18747
diff
changeset
|
78 public abstract void define(Object key, Object value, int flags); |
18407
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
79 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
80 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
81 * Define new property with a static location or change existing property. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
82 * |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
83 * @param key property identifier |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
84 * @param value value to be set |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
85 * @param flags flags to be set |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
86 * @param locationFactory factory function that creates a location for a given shape and value |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
87 */ |
19336
723142fed324
Change DynamicObject from an interface to an abstract class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18747
diff
changeset
|
88 public abstract void define(Object key, Object value, int flags, LocationFactory locationFactory); |
18407
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
89 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
90 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
91 * Change property flags. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
92 * |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
93 * @param key property identifier |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
94 * @param newFlags flags to be set |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
95 * @return {@code true} if successful or {@code false} if property not found |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
96 */ |
19336
723142fed324
Change DynamicObject from an interface to an abstract class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18747
diff
changeset
|
97 public abstract boolean changeFlags(Object key, int newFlags); |
18407
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
98 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
99 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
100 * Change property flags. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
101 * |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
102 * @param key property identifier |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
103 * @param flagsUpdateFunction function updating old flags to new flags |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
104 * @return {@code true} if successful or {@code false} if property not found |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
105 */ |
19336
723142fed324
Change DynamicObject from an interface to an abstract class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18747
diff
changeset
|
106 public abstract boolean changeFlags(Object key, FlagsFunction flagsUpdateFunction); |
18407
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
107 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
108 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
109 * Delete property. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
110 * |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
111 * @param key property identifier |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
112 * @return {@code true} if successful or {@code false} if property not found |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
113 */ |
19336
723142fed324
Change DynamicObject from an interface to an abstract class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18747
diff
changeset
|
114 public abstract boolean delete(Object key); |
18407
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
115 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
116 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
117 * Returns the number of properties in this object. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
118 */ |
19336
723142fed324
Change DynamicObject from an interface to an abstract class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18747
diff
changeset
|
119 public abstract int size(); |
18407
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
120 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
121 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
122 * Returns {@code true} if this object contains no properties. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
123 */ |
19336
723142fed324
Change DynamicObject from an interface to an abstract class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18747
diff
changeset
|
124 public abstract boolean isEmpty(); |
18407
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
125 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
126 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
127 * Set object shape and grow storage if necessary. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
128 * |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
129 * @param oldShape the object's current shape (must equal {@link #getShape()}) |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
130 * @param newShape the new shape to be set |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
131 */ |
19336
723142fed324
Change DynamicObject from an interface to an abstract class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18747
diff
changeset
|
132 public abstract void setShapeAndGrow(Shape oldShape, Shape newShape); |
18407
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
133 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
134 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
135 * Set object shape and resize storage if necessary. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
136 * |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
137 * @param oldShape the object's current shape (must equal {@link #getShape()}) |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
138 * @param newShape the new shape to be set |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
139 */ |
19336
723142fed324
Change DynamicObject from an interface to an abstract class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18747
diff
changeset
|
140 public abstract void setShapeAndResize(Shape oldShape, Shape newShape); |
18407
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
141 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
142 /** |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
143 * Ensure object shape is up-to-date. |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
144 * |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
145 * @return {@code true} if shape has changed |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
146 */ |
19336
723142fed324
Change DynamicObject from an interface to an abstract class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18747
diff
changeset
|
147 public abstract boolean updateShape(); |
18407
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
148 |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
149 public interface FlagsFunction { |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
150 int apply(int t); |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
151 } |
f439fdb137a3
Truffle: initial commit of object API
Andreas Woess <andreas.woess@jku.at>
parents:
diff
changeset
|
152 } |