Add vendor API to software math.
[SquirrelJME.git] / modules / cldc-compact / src / main / java / cc / squirreljme / jvm / mle / ObjectShelf.java
blob15e0004047c5b43f9397e353ac357140740bae23
1 // -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
3 // SquirrelJME
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the GNU General Public License v3+, or later.
7 // See license.mkd for licensing and copyright information.
8 // ---------------------------------------------------------------------------
10 package cc.squirreljme.jvm.mle;
12 import cc.squirreljme.jvm.mle.brackets.TypeBracket;
13 import cc.squirreljme.jvm.mle.constants.MonitorResultType;
14 import cc.squirreljme.jvm.mle.exceptions.MLECallError;
15 import cc.squirreljme.runtime.cldc.annotation.Api;
17 /**
18 * This shelf supports object anything that has to do with objects.
20 * @since 2020/06/09
22 @SquirrelJMEVendorApi
23 public final class ObjectShelf
25 /**
26 * Not used.
28 * @since 2020/06/09
30 private ObjectShelf()
34 /**
35 * Checks if the given object can be stored in the specified array.
37 * @param __array The array to check.
38 * @param __val The value to check
39 * @return If the value can be stored in the given array.
40 * @throws MLECallError If given type is not an array or {@code __array}
41 * is {@code null}.
42 * @since 2021/02/07
44 @SquirrelJMEVendorApi
45 public static native boolean arrayCheckStore(Object __array, Object __val)
46 throws MLECallError;
48 /**
49 * Copies the given arrays. If the source and destination are the same
50 * array, the copy operation will not collide with itself.
52 * @param __src The source array.
53 * @param __srcOff The source offset.
54 * @param __dest The destination array.
55 * @param __destOff The destination offset.
56 * @param __len The elements to copy.
57 * @since 2020/06/22
59 @SquirrelJMEVendorApi
60 public static native void arrayCopy(boolean[] __src, int __srcOff,
61 boolean[] __dest, int __destOff, int __len);
63 /**
64 * Copies the given arrays. If the source and destination are the same
65 * array, the copy operation will not collide with itself.
67 * @param __src The source array.
68 * @param __srcOff The source offset.
69 * @param __dest The destination array.
70 * @param __destOff The destination offset.
71 * @param __len The elements to copy.
72 * @since 2020/06/22
74 @SquirrelJMEVendorApi
75 public static native void arrayCopy(byte[] __src, int __srcOff,
76 byte[] __dest, int __destOff, int __len);
78 /**
79 * Copies the given arrays. If the source and destination are the same
80 * array, the copy operation will not collide with itself.
82 * @param __src The source array.
83 * @param __srcOff The source offset.
84 * @param __dest The destination array.
85 * @param __destOff The destination offset.
86 * @param __len The elements to copy.
87 * @since 2020/06/22
89 @SquirrelJMEVendorApi
90 public static native void arrayCopy(short[] __src, int __srcOff,
91 short[] __dest, int __destOff, int __len);
93 /**
94 * Copies the given arrays. If the source and destination are the same
95 * array, the copy operation will not collide with itself.
97 * @param __src The source array.
98 * @param __srcOff The source offset.
99 * @param __dest The destination array.
100 * @param __destOff The destination offset.
101 * @param __len The elements to copy.
102 * @since 2020/06/22
104 @SquirrelJMEVendorApi
105 public static native void arrayCopy(char[] __src, int __srcOff,
106 char[] __dest, int __destOff, int __len);
109 * Copies the given arrays. If the source and destination are the same
110 * array, the copy operation will not collide with itself.
112 * @param __src The source array.
113 * @param __srcOff The source offset.
114 * @param __dest The destination array.
115 * @param __destOff The destination offset.
116 * @param __len The elements to copy.
117 * @since 2020/06/22
119 @SquirrelJMEVendorApi
120 public static native void arrayCopy(int[] __src, int __srcOff,
121 int[] __dest, int __destOff, int __len);
124 * Copies the given arrays. If the source and destination are the same
125 * array, the copy operation will not collide with itself.
127 * @param __src The source array.
128 * @param __srcOff The source offset.
129 * @param __dest The destination array.
130 * @param __destOff The destination offset.
131 * @param __len The elements to copy.
132 * @since 2020/06/22
134 @SquirrelJMEVendorApi
135 public static native void arrayCopy(long[] __src, int __srcOff,
136 long[] __dest, int __destOff, int __len);
139 * Copies the given arrays. If the source and destination are the same
140 * array, the copy operation will not collide with itself.
142 * @param __src The source array.
143 * @param __srcOff The source offset.
144 * @param __dest The destination array.
145 * @param __destOff The destination offset.
146 * @param __len The elements to copy.
147 * @since 2020/06/22
149 @SquirrelJMEVendorApi
150 public static native void arrayCopy(float[] __src, int __srcOff,
151 float[] __dest, int __destOff, int __len);
154 * Copies the given arrays. If the source and destination are the same
155 * array, the copy operation will not collide with itself.
157 * @param __src The source array.
158 * @param __srcOff The source offset.
159 * @param __dest The destination array.
160 * @param __destOff The destination offset.
161 * @param __len The elements to copy.
162 * @since 2020/06/22
164 @SquirrelJMEVendorApi
165 public static native void arrayCopy(double[] __src, int __srcOff,
166 double[] __dest, int __destOff, int __len);
169 * Fills part of the given array with the specified value.
171 * @param __b The buffer to fill.
172 * @param __o The offset into the buffer.
173 * @param __l The length of the bytes to fill.
174 * @param __v The value to store into the buffer.
175 * @throws MLECallError If any argument is {@code null}, or the offset
176 * and/or length exceed the array bounds.
177 * @since 2021/12/26
179 @SquirrelJMEVendorApi
180 public static native void arrayFill(boolean[] __b, int __o, int __l,
181 boolean __v)
182 throws MLECallError;
185 * Fills part of the given array with the specified value.
187 * @param __b The buffer to fill.
188 * @param __o The offset into the buffer.
189 * @param __l The length of the bytes to fill.
190 * @param __v The value to store into the buffer.
191 * @throws MLECallError If any argument is {@code null}, or the offset
192 * and/or length exceed the array bounds.
193 * @since 2021/12/26
195 @SquirrelJMEVendorApi
196 public static native void arrayFill(byte[] __b, int __o, int __l,
197 byte __v)
198 throws MLECallError;
201 * Fills part of the given array with the specified value.
203 * @param __b The buffer to fill.
204 * @param __o The offset into the buffer.
205 * @param __l The length of the bytes to fill.
206 * @param __v The value to store into the buffer.
207 * @throws MLECallError If any argument is {@code null}, or the offset
208 * and/or length exceed the array bounds.
209 * @since 2021/12/26
211 @SquirrelJMEVendorApi
212 public static native void arrayFill(short[] __b, int __o, int __l,
213 short __v)
214 throws MLECallError;
217 * Fills part of the given array with the specified value.
219 * @param __b The buffer to fill.
220 * @param __o The offset into the buffer.
221 * @param __l The length of the bytes to fill.
222 * @param __v The value to store into the buffer.
223 * @throws MLECallError If any argument is {@code null}, or the offset
224 * and/or length exceed the array bounds.
225 * @since 2021/12/26
227 @SquirrelJMEVendorApi
228 public static native void arrayFill(char[] __b, int __o, int __l,
229 char __v)
230 throws MLECallError;
233 * Fills part of the given array with the specified value.
235 * @param __b The buffer to fill.
236 * @param __o The offset into the buffer.
237 * @param __l The length of the bytes to fill.
238 * @param __v The value to store into the buffer.
239 * @throws MLECallError If any argument is {@code null}, or the offset
240 * and/or length exceed the array bounds.
241 * @since 2021/12/26
243 @SquirrelJMEVendorApi
244 public static native void arrayFill(int[] __b, int __o, int __l,
245 int __v)
246 throws MLECallError;
249 * Fills part of the given array with the specified value.
251 * @param __b The buffer to fill.
252 * @param __o The offset into the buffer.
253 * @param __l The length of the bytes to fill.
254 * @param __v The value to store into the buffer.
255 * @throws MLECallError If any argument is {@code null}, or the offset
256 * and/or length exceed the array bounds.
257 * @since 2021/12/26
259 @SquirrelJMEVendorApi
260 public static native void arrayFill(long[] __b, int __o, int __l,
261 long __v)
262 throws MLECallError;
265 * Fills part of the given array with the specified value.
267 * @param __b The buffer to fill.
268 * @param __o The offset into the buffer.
269 * @param __l The length of the bytes to fill.
270 * @param __v The value to store into the buffer.
271 * @throws MLECallError If any argument is {@code null}, or the offset
272 * and/or length exceed the array bounds.
273 * @since 2021/12/26
275 @SquirrelJMEVendorApi
276 public static native void arrayFill(float[] __b, int __o, int __l,
277 float __v)
278 throws MLECallError;
281 * Fills part of the given array with the specified value.
283 * @param __b The buffer to fill.
284 * @param __o The offset into the buffer.
285 * @param __l The length of the bytes to fill.
286 * @param __v The value to store into the buffer.
287 * @throws MLECallError If any argument is {@code null}, or the offset
288 * and/or length exceed the array bounds.
289 * @since 2021/12/26
291 @SquirrelJMEVendorApi
292 public static native void arrayFill(double[] __b, int __o, int __l,
293 double __v)
294 throws MLECallError;
297 * Returns the length of the array if this object is an array.
299 * @param __object The object to get the length of.
300 * @return The length of the array or a negative value if this is not an
301 * array.
302 * @since 2020/06/09
304 @SquirrelJMEVendorApi
305 public static native int arrayLength(Object __object);
308 * Allocates a new array.
310 * @param <T> The resultant type of the array.
311 * @param __type The type to allocate the array for.
312 * @param __len The length of the array.
313 * @return The newly allocated array as the given object.
314 * @since 2020/06/09
316 @SquirrelJMEVendorApi
317 public static native <T> T arrayNew(TypeBracket __type, int __len);
320 * Checks if the given thread holds the lock on the given method.
322 * @param __javaThread The Java thread to check if it holds the lock.
323 * @param __o The object to check.
324 * @return If the given thread holds the lock.
325 * @since 2020/06/17
327 @SquirrelJMEVendorApi
328 public static native boolean holdsLock(Thread __javaThread, Object __o);
331 * Returns the identity hashcode of the object.
333 * @param __o The object to get the hashcode of.
334 * @return The identity hashcode of the object.
335 * @since 2020/06/18
337 @SquirrelJMEVendorApi
338 public static native int identityHashCode(Object __o);
341 * Checks if this object is an array.
343 * @param __object The object to check.
344 * @return If this object is an array.
345 * @since 2021/04/07
347 @SquirrelJMEVendorApi
348 public static native boolean isArray(Object __object);
351 * Checks if this object is an instance of the given type.
353 * @param __o The object to check.
354 * @param __type The type it may be.
355 * @return If this object is an instance of the given type.
356 * @throws MLECallError If {@code __type} is null.
357 * @since 2021/02/07
359 @SquirrelJMEVendorApi
360 public static native boolean isInstance(Object __o, TypeBracket __type)
361 throws MLECallError;
364 * Creates a new instance of the given type.
366 * @param __type The type to instantiate.
367 * @return The newly created object or {@code null} if there was no
368 * memory left.
369 * @since 2020/06/17
371 @SquirrelJMEVendorApi
372 public static native Object newInstance(TypeBracket __type);
375 * Notifies the monitors holding onto this object.
377 * @param __object The object to signal.
378 * @param __all Notify all threads?
379 * @return The {@link MonitorResultType}.
380 * @since 2020/06/22
382 @SquirrelJMEVendorApi
383 public static native int notify(Object __object, boolean __all);
386 * Waits on the given monitor.
388 * If the monitor will block and SquirrelJME is running in cooperative
389 * single threaded mode, this will relinquish control of the current
390 * thread.
392 * @param __object The object to wait on.
393 * @param __ms The milliseconds to wait.
394 * @param __ns The nanoseconds to wait.
395 * @return The {@link MonitorResultType}.
396 * @since 2020/06/22
398 @SquirrelJMEVendorApi
399 public static native int wait(Object __object, long __ms, int __ns);