SimpleObject.java 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. package com.amazon.test;
  9. import java.util.Random;
  10. public class SimpleObject
  11. {
  12. public class Foo
  13. {
  14. public Foo(int seed)
  15. {
  16. Random rand = new Random(seed);
  17. m_value = rand.nextInt();
  18. }
  19. // ----
  20. public int m_value;
  21. }
  22. // ----
  23. public SimpleObject() {}
  24. public boolean GetBool() { return true; }
  25. public boolean[] GetBoolArray() { return new boolean[] { true, false, true, false }; }
  26. public char GetChar() { return 'L'; }
  27. public char[] GetCharArray() { return new char[] { 'L', 'u', 'm', 'b', 'e', 'r', 'y', 'a', 'r', 'd' }; }
  28. public byte GetByte() { return 1; }
  29. public byte[] GetByteArray() { return new byte[] { 1, 2, 4, 8, 16, 32 }; }
  30. public short GetShort() { return 128; }
  31. public short[] GetShortArray() { return new short[] { 128, 256, 512, 1024, 2048, 8192 }; }
  32. public int GetInt() { return 32768; }
  33. public int[] GetIntArray() { return new int[] { 32768, 65536, 131072, 262144, 524288, 1048576 }; }
  34. public float GetFloat() { return (float)Math.PI; }
  35. public float[] GetFloatArray()
  36. {
  37. float[] result = new float[6];
  38. for (int i = 0; i < 6; ++i)
  39. {
  40. result[i] = (float)(i + 1) / 7.0f;
  41. }
  42. return result;
  43. }
  44. public double GetDouble() { return Math.PI; }
  45. public double[] GetDoubleArray()
  46. {
  47. double[] result = new double[6];
  48. for (int i = 0; i < 6; ++i)
  49. {
  50. result[i] = (double)(i + 1) / 7.0;
  51. }
  52. return result;
  53. }
  54. public Class GetClass() { return this.getClass(); }
  55. public String GetString() { return "Amazon Lumberyard"; }
  56. public Foo GetObject() { return new Foo(1); }
  57. public Foo[] GetObjectArray() { return new Foo[] { new Foo(1), new Foo(2), new Foo(3), new Foo(4) }; }
  58. // ----
  59. private static final String TAG = "SimpleObject";
  60. }