2 * Back 2 Browser Bytecode Translator
3 * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, version 2 of the License.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. Look for COPYING file in the top folder.
16 * If not, see http://opensource.org/licenses/GPL-2.0.
18 package org.apidesign.vm4brwsr;
22 * @author Jaroslav Tulach <jtulach@netbeans.org>
26 short[] shorts = { 2, 3 };
27 int[] ints = { 4, 5, 6 };
28 float[] floats = { 7, 8, 9, 10 };
29 double[][] doubles = { {11}, {12}, {13}, {14}, {15} };
30 char[] chars = { 'a', 'b' };
54 static double[][] dbls = new double[1][2];
55 public static double twoDoubles() {
56 return dbls[0][0] + dbls[0][0];
59 static int[][] tints = new int[1][2];
60 public static int twoInts() {
61 return tints[0][0] + tints[0][0];
64 private static final Array[] ARR = { new Array(), new Array(), new Array() };
66 private static Array[][] arr() {
67 Array[][] matrix = new Array[3][3];
68 for (int i = 0; i < ARR.length; i++) {
69 matrix[i][i] = ARR[i];
73 private static <T> T[] filter(T[] in) {
77 public static double sum() {
79 for (Array[] row : arr()) {
90 sum += filter(row)[indx].doubles();
95 private static final int[] arr = { 0, 1, 2, 3, 4, 5 };
96 public static int simple(boolean clone) {
111 public static String objectArrayClass() {
112 return Object[].class.getName();
115 public static boolean instanceOfArray(Object obj) {
116 return obj instanceof Object[];
119 public static int sum(int size) {
120 int[] arr = new int[size];
121 return arr[0] + arr[1];
124 static void arraycopy(char[] value, int srcBegin, char[] dst, int dstBegin, int count) {
125 while (count-- > 0) {
126 dst[dstBegin++] = value[srcBegin++];
130 public static char copyArray() {
131 char[] arr = { '0' };
132 arraycopy(arr()[0][0].chars, 0, arr, 0, 1);