PageRenderTime 76ms CodeModel.GetById 26ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/test-suite/java/arrays_global_twodim_runme.java

#
Java | 33 lines | 26 code | 5 blank | 2 comment | 4 complexity | 0a5ce6d64f12a531f8f32a7d886bbcea MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. // Two dimension arrays test
  2. import arrays_global_twodim.*;
  3. public class arrays_global_twodim_runme {
  4. static {
  5. try {
  6. System.loadLibrary("arrays_global_twodim");
  7. } catch (UnsatisfiedLinkError e) {
  8. System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
  9. System.exit(1);
  10. }
  11. }
  12. public static void main(String argv[])
  13. {
  14. SWIGTYPE_p_a_4__int constintarray2d = arrays_global_twodim.getArray_const_i();
  15. SWIGTYPE_p_a_4__int intarray2d = arrays_global_twodim.getArray_i();
  16. // Set all the non const int array members from the const int array members and check
  17. arrays_global_twodim.setArray_i(constintarray2d);
  18. int count = 10;
  19. for (int x=0; x<arrays_global_twodim.ARRAY_LEN_X; x++) {
  20. for (int y=0; y<arrays_global_twodim.ARRAY_LEN_Y; y++) {
  21. if ( arrays_global_twodim.get_2d_array(intarray2d, x, y) != count++) {
  22. System.out.println("Value incorrect array_i[" + x + "][" + y + "]");
  23. System.exit(1);
  24. }
  25. }
  26. }
  27. }
  28. }