PageRenderTime 38ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

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

#
Java | 54 lines | 44 code | 10 blank | 0 comment | 12 complexity | 53ed30b7e2eeac436db191c01cdaf6c4 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. import director_enum.*;
  2. public class director_enum_runme {
  3. static {
  4. try {
  5. System.loadLibrary("director_enum");
  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_enum_MyFoo a = new director_enum_MyFoo();
  13. if (a.ping(Hallo.awright) != Hallo.yo) {
  14. throw new RuntimeException ( "a.ping()" );
  15. }
  16. if (a.ping_ref(Hallo.awright) != Hallo.hello) {
  17. throw new RuntimeException ( "a.ping_ref()" );
  18. }
  19. if (a.ping_member_enum(Foo.Bye.adios) != Foo.Bye.aufwiedersehen) {
  20. throw new RuntimeException ( "a.ping_member_enum()" );
  21. }
  22. Foo b = new Foo();
  23. if (b.ping(Hallo.awright) != Hallo.awright) {
  24. throw new RuntimeException ( "b.ping()" );
  25. }
  26. if (b.ping_ref(Hallo.awright) != Hallo.awright) {
  27. throw new RuntimeException ( "b.ping_ref()" );
  28. }
  29. if (b.ping_member_enum(Foo.Bye.adios) != Foo.Bye.adios) {
  30. throw new RuntimeException ( "b.ping_member_enum()" );
  31. }
  32. }
  33. }
  34. class director_enum_MyFoo extends Foo {
  35. public Hallo say_hi(Hallo h) {
  36. return Hallo.yo;
  37. }
  38. public Hallo say_hi_ref(Hallo h) {
  39. return Hallo.hello;
  40. }
  41. public Foo.Bye say_bye(Foo.Bye b) {
  42. return Foo.Bye.aufwiedersehen;
  43. }
  44. }