0N/A/*
1472N/A * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
0N/A *
0N/A */
0N/A
0N/Apackage sun.jvm.hotspot.utilities.soql;
0N/A
0N/Aimport java.util.*;
0N/Aimport sun.jvm.hotspot.oops.*;
0N/Aimport sun.jvm.hotspot.utilities.*;
0N/A
0N/A/**
0N/A This is JavaScript wrapper for TypeArrayKlass.
0N/A*/
0N/A
0N/Apublic class JSJavaTypeArrayKlass extends JSJavaArrayKlass {
0N/A public JSJavaTypeArrayKlass(TypeArrayKlass kls, JSJavaFactory fac) {
0N/A super(kls, fac);
0N/A }
0N/A
0N/A public final TypeArrayKlass getTypeArrayKlass() {
0N/A return (TypeArrayKlass) getArrayKlass();
0N/A }
0N/A
0N/A public String getName() {
0N/A int type = (int) getTypeArrayKlass().getElementType();
0N/A switch (type) {
0N/A case TypeArrayKlass.T_BOOLEAN:
0N/A return "boolean[]";
0N/A case TypeArrayKlass.T_CHAR:
0N/A return "char[]";
0N/A case TypeArrayKlass.T_FLOAT:
0N/A return "float[]";
0N/A case TypeArrayKlass.T_DOUBLE:
0N/A return "double[]";
0N/A case TypeArrayKlass.T_BYTE:
0N/A return "byte[]";
0N/A case TypeArrayKlass.T_SHORT:
0N/A return "short[]";
0N/A case TypeArrayKlass.T_INT:
0N/A return "int[]";
0N/A case TypeArrayKlass.T_LONG:
0N/A return "long[]";
0N/A default:
0N/A if (Assert.ASSERTS_ENABLED) {
0N/A Assert.that(false, "Unknown primitive array type");
0N/A }
0N/A return null;
0N/A }
0N/A }
0N/A
0N/A public Object getFieldValue(int index, Array array) {
0N/A TypeArray typeArr = (TypeArray) array;
0N/A int type = (int) getTypeArrayKlass().getElementType();
0N/A switch (type) {
0N/A case TypeArrayKlass.T_BOOLEAN:
0N/A return Boolean.valueOf(typeArr.getBooleanAt(index));
0N/A case TypeArrayKlass.T_CHAR:
0N/A return new String(new char[] { typeArr.getCharAt(index) });
0N/A case TypeArrayKlass.T_FLOAT:
0N/A return new Float(typeArr.getFloatAt(index));
0N/A case TypeArrayKlass.T_DOUBLE:
0N/A return new Double(typeArr.getDoubleAt(index));
0N/A case TypeArrayKlass.T_BYTE:
0N/A return new Byte(typeArr.getByteAt(index));
0N/A case TypeArrayKlass.T_SHORT:
0N/A return new Short(typeArr.getShortAt(index));
0N/A case TypeArrayKlass.T_INT:
0N/A return new Integer(typeArr.getIntAt(index));
0N/A case TypeArrayKlass.T_LONG:
0N/A return new Long(typeArr.getLongAt(index));
0N/A default:
0N/A if (Assert.ASSERTS_ENABLED) {
0N/A Assert.that(false, "Unknown primitive array type");
0N/A }
0N/A return null;
0N/A }
0N/A }
0N/A}