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

/tags/rel-1-3-15/SWIG/Examples/java/enum/main.java

#
Java | 39 lines | 31 code | 7 blank | 1 comment | 0 complexity | 1ed7ae66526bb9f36ff7ab6009f76244 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. public class main {
  2. static {
  3. try {
  4. System.loadLibrary("example");
  5. } catch (UnsatisfiedLinkError e) {
  6. 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);
  7. System.exit(1);
  8. }
  9. }
  10. public static void main(String argv[])
  11. {
  12. // Print out the value of some enums
  13. System.out.println("*** color ***");
  14. System.out.println(" RED = " + example.RED);
  15. System.out.println(" BLUE = " + example.BLUE);
  16. System.out.println(" GREEN = " + example.GREEN);
  17. System.out.println("\n*** Foo::speed ***");
  18. System.out.println(" Foo::IMPULSE = " + Foo.IMPULSE);
  19. System.out.println(" Foo::WARP = " + Foo.WARP);
  20. System.out.println(" Foo::LUDICROUS = " + Foo.LUDICROUS);
  21. System.out.println("\nTesting use of enums with functions\n");
  22. example.enum_test(example.RED, Foo.IMPULSE);
  23. example.enum_test(example.BLUE, Foo.WARP);
  24. example.enum_test(example.GREEN, Foo.LUDICROUS);
  25. example.enum_test(1234,5678);
  26. System.out.println( "\nTesting use of enum with class method" );
  27. Foo f = new Foo();
  28. f.enum_test(Foo.IMPULSE);
  29. f.enum_test(Foo.WARP);
  30. f.enum_test(Foo.LUDICROUS);
  31. }
  32. }