PageRenderTime 49ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/rel-1-3-26/SWIG/Examples/test-suite/java/director_string_runme.java

#
Java | 44 lines | 30 code | 11 blank | 3 comment | 2 complexity | 9058e4d55e5bb1b6547cf46992a80ead MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. import director_string.*;
  2. public class director_string_runme {
  3. static {
  4. try {
  5. System.loadLibrary("director_string");
  6. } catch (UnsatisfiedLinkError e) {
  7. 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);
  8. System.exit(1);
  9. }
  10. }
  11. public static void main(String argv[]) {
  12. director_string_B b = new director_string_B("hello");
  13. String s;
  14. s = b.call_get_first();
  15. if (!s.equals("director_string_B.get_first")) throw new RuntimeException("call_get_first() failed");
  16. s = b.call_get(0);
  17. if (!s.equals("director_string_B.get")) throw new RuntimeException("get(0) failed");
  18. // if (!s.equals("director_string_B.get: hello")) throw new RuntimeException("get(0) failed");
  19. }
  20. }
  21. class director_string_B extends A {
  22. public director_string_B(String first) {
  23. super(first);
  24. }
  25. public String get_first() {
  26. return "director_string_B.get_first";
  27. }
  28. public String get(int n) {
  29. return "director_string_B.get";
  30. // recursive call problem (needs fixing)
  31. // return "director_string_B.get: " + super.get(n);
  32. }
  33. }