1*795d594fSAndroid Build Coastguard Worker /* 2*795d594fSAndroid Build Coastguard Worker * Copyright (C) 2018 The Android Open Source Project 3*795d594fSAndroid Build Coastguard Worker * 4*795d594fSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License"); 5*795d594fSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License. 6*795d594fSAndroid Build Coastguard Worker * You may obtain a copy of the License at 7*795d594fSAndroid Build Coastguard Worker * 8*795d594fSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0 9*795d594fSAndroid Build Coastguard Worker * 10*795d594fSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software 11*795d594fSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS, 12*795d594fSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*795d594fSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and 14*795d594fSAndroid Build Coastguard Worker * limitations under the License. 15*795d594fSAndroid Build Coastguard Worker */ 16*795d594fSAndroid Build Coastguard Worker 17*795d594fSAndroid Build Coastguard Worker /** Sample values for use in VarHandle tests. These are here to avoid repeatedly boxing which 18*795d594fSAndroid Build Coastguard Worker * makes gcstress tests run slowly. */ 19*795d594fSAndroid Build Coastguard Worker public class SampleValues { 20*795d594fSAndroid Build Coastguard Worker public static final boolean[] PRIMITIVE_BOOLEANS = new boolean[] {true, false}; 21*795d594fSAndroid Build Coastguard Worker 22*795d594fSAndroid Build Coastguard Worker public static final Boolean[] BOOLEANS = new Boolean[] {true, false}; 23*795d594fSAndroid Build Coastguard Worker 24*795d594fSAndroid Build Coastguard Worker public static final byte[] PRIMITIVE_BYTES = 25*795d594fSAndroid Build Coastguard Worker new byte[] {(byte) -128, (byte) -61, (byte) 7, (byte) 127, (byte) 33}; 26*795d594fSAndroid Build Coastguard Worker 27*795d594fSAndroid Build Coastguard Worker public static final Byte[] BYTES = 28*795d594fSAndroid Build Coastguard Worker new Byte[] {(byte) -128, (byte) -61, (byte) 7, (byte) 127, (byte) 33}; 29*795d594fSAndroid Build Coastguard Worker 30*795d594fSAndroid Build Coastguard Worker public static final short[] PRIMITIVE_SHORTS = 31*795d594fSAndroid Build Coastguard Worker new short[] {(short) -32768, (short) -384, (short) 32767, (short) 0xaa55}; 32*795d594fSAndroid Build Coastguard Worker 33*795d594fSAndroid Build Coastguard Worker public static final Short[] SHORTS = 34*795d594fSAndroid Build Coastguard Worker new Short[] {(short) -32768, (short) -384, (short) 32767, (short) 0xaa55}; 35*795d594fSAndroid Build Coastguard Worker 36*795d594fSAndroid Build Coastguard Worker public static final char[] PRIMITIVE_CHARS = 37*795d594fSAndroid Build Coastguard Worker new char[] {'A', '#', '$', 'Z', 't', 'c'}; 38*795d594fSAndroid Build Coastguard Worker 39*795d594fSAndroid Build Coastguard Worker public static final Character[] CHARACTERS = 40*795d594fSAndroid Build Coastguard Worker new Character[] {'A', '#', '$', 'Z', 't', 'c'}; 41*795d594fSAndroid Build Coastguard Worker 42*795d594fSAndroid Build Coastguard Worker public static final int[] PRIMITIVE_INTS = 43*795d594fSAndroid Build Coastguard Worker new int[] {-0x01234567, 0x7f6e5d4c, 0x12345678, 0x10215220, 42}; 44*795d594fSAndroid Build Coastguard Worker 45*795d594fSAndroid Build Coastguard Worker public static final Integer[] INTEGERS = 46*795d594fSAndroid Build Coastguard Worker new Integer[] {-0x01234567, 0x7f6e5d4c, 0x12345678, 0x10215220, 42}; 47*795d594fSAndroid Build Coastguard Worker 48*795d594fSAndroid Build Coastguard Worker public static final long[] PRIMITIVE_LONGS = 49*795d594fSAndroid Build Coastguard Worker new long[] {-0x0123456789abcdefl, 0x789abcdef0123456l, 0xfedcba9876543210l}; 50*795d594fSAndroid Build Coastguard Worker 51*795d594fSAndroid Build Coastguard Worker public static final Long[] LONGS = 52*795d594fSAndroid Build Coastguard Worker new Long[] {-0x0123456789abcdefl, 0x789abcdef0123456l, 0xfedcba9876543210l}; 53*795d594fSAndroid Build Coastguard Worker 54*795d594fSAndroid Build Coastguard Worker public static final float[] PRIMITIVE_FLOATS = 55*795d594fSAndroid Build Coastguard Worker new float[] {-7.77e23f, 1.234e-17f, 3.40e36f, -8.888e3f, 4.442e11f}; 56*795d594fSAndroid Build Coastguard Worker 57*795d594fSAndroid Build Coastguard Worker public static final Float[] FLOATS = 58*795d594fSAndroid Build Coastguard Worker new Float[] {-7.77e23f, 1.234e-17f, 3.40e36f, -8.888e3f, 4.442e11f}; 59*795d594fSAndroid Build Coastguard Worker 60*795d594fSAndroid Build Coastguard Worker public static final double[] PRIMITIVE_DOUBLES = 61*795d594fSAndroid Build Coastguard Worker new double[] {-1.0e-200, 1.11e200, 3.141, 1.1111, 6.022e23, 6.626e-34}; 62*795d594fSAndroid Build Coastguard Worker 63*795d594fSAndroid Build Coastguard Worker public static final Double[] DOUBLES = 64*795d594fSAndroid Build Coastguard Worker new Double[] {-1.0e-200, 1.11e200, 3.141, 1.1111, 6.022e23, 6.626e-34}; 65*795d594fSAndroid Build Coastguard Worker get_boolean(int index)66*795d594fSAndroid Build Coastguard Worker public static boolean get_boolean(int index) { 67*795d594fSAndroid Build Coastguard Worker return PRIMITIVE_BOOLEANS[index]; 68*795d594fSAndroid Build Coastguard Worker } 69*795d594fSAndroid Build Coastguard Worker get_Boolean(int index)70*795d594fSAndroid Build Coastguard Worker public static Boolean get_Boolean(int index) { 71*795d594fSAndroid Build Coastguard Worker return BOOLEANS[index]; 72*795d594fSAndroid Build Coastguard Worker } 73*795d594fSAndroid Build Coastguard Worker get_byte(int index)74*795d594fSAndroid Build Coastguard Worker public static byte get_byte(int index) { 75*795d594fSAndroid Build Coastguard Worker return PRIMITIVE_BYTES[index]; 76*795d594fSAndroid Build Coastguard Worker } 77*795d594fSAndroid Build Coastguard Worker get_Byte(int index)78*795d594fSAndroid Build Coastguard Worker public static Byte get_Byte(int index) { 79*795d594fSAndroid Build Coastguard Worker return BYTES[index]; 80*795d594fSAndroid Build Coastguard Worker } 81*795d594fSAndroid Build Coastguard Worker get_short(int index)82*795d594fSAndroid Build Coastguard Worker public static short get_short(int index) { 83*795d594fSAndroid Build Coastguard Worker return PRIMITIVE_SHORTS[index]; 84*795d594fSAndroid Build Coastguard Worker } 85*795d594fSAndroid Build Coastguard Worker get_Short(int index)86*795d594fSAndroid Build Coastguard Worker public static Short get_Short(int index) { 87*795d594fSAndroid Build Coastguard Worker return SHORTS[index]; 88*795d594fSAndroid Build Coastguard Worker } 89*795d594fSAndroid Build Coastguard Worker get_char(int index)90*795d594fSAndroid Build Coastguard Worker public static char get_char(int index) { 91*795d594fSAndroid Build Coastguard Worker return PRIMITIVE_CHARS[index]; 92*795d594fSAndroid Build Coastguard Worker } 93*795d594fSAndroid Build Coastguard Worker get_Character(int index)94*795d594fSAndroid Build Coastguard Worker public static Character get_Character(int index) { 95*795d594fSAndroid Build Coastguard Worker return CHARACTERS[index]; 96*795d594fSAndroid Build Coastguard Worker } 97*795d594fSAndroid Build Coastguard Worker get_int(int index)98*795d594fSAndroid Build Coastguard Worker public static int get_int(int index) { 99*795d594fSAndroid Build Coastguard Worker return PRIMITIVE_INTS[index]; 100*795d594fSAndroid Build Coastguard Worker } 101*795d594fSAndroid Build Coastguard Worker get_Integer(int index)102*795d594fSAndroid Build Coastguard Worker public static Integer get_Integer(int index) { 103*795d594fSAndroid Build Coastguard Worker return INTEGERS[index]; 104*795d594fSAndroid Build Coastguard Worker } 105*795d594fSAndroid Build Coastguard Worker get_long(int index)106*795d594fSAndroid Build Coastguard Worker public static long get_long(int index) { 107*795d594fSAndroid Build Coastguard Worker return PRIMITIVE_LONGS[index]; 108*795d594fSAndroid Build Coastguard Worker } 109*795d594fSAndroid Build Coastguard Worker get_Long(int index)110*795d594fSAndroid Build Coastguard Worker public static Long get_Long(int index) { 111*795d594fSAndroid Build Coastguard Worker return LONGS[index]; 112*795d594fSAndroid Build Coastguard Worker } 113*795d594fSAndroid Build Coastguard Worker get_float(int index)114*795d594fSAndroid Build Coastguard Worker public static float get_float(int index) { 115*795d594fSAndroid Build Coastguard Worker return PRIMITIVE_FLOATS[index]; 116*795d594fSAndroid Build Coastguard Worker } 117*795d594fSAndroid Build Coastguard Worker get_Float(int index)118*795d594fSAndroid Build Coastguard Worker public static Float get_Float(int index) { 119*795d594fSAndroid Build Coastguard Worker return FLOATS[index]; 120*795d594fSAndroid Build Coastguard Worker } 121*795d594fSAndroid Build Coastguard Worker get_double(int index)122*795d594fSAndroid Build Coastguard Worker public static double get_double(int index) { 123*795d594fSAndroid Build Coastguard Worker return PRIMITIVE_DOUBLES[index]; 124*795d594fSAndroid Build Coastguard Worker } 125*795d594fSAndroid Build Coastguard Worker get_Double(int index)126*795d594fSAndroid Build Coastguard Worker public static Double get_Double(int index) { 127*795d594fSAndroid Build Coastguard Worker return DOUBLES[index]; 128*795d594fSAndroid Build Coastguard Worker } 129*795d594fSAndroid Build Coastguard Worker } 130*795d594fSAndroid Build Coastguard Worker 131