PageRenderTime 45ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/Examples/java/enum/runme.java

#
Java | 38 lines | 30 code | 7 blank | 1 comment | 0 complexity | eabebc5f21ef86ba793feb9d7a76768c MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. public class runme {
  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(" " + color.RED + " = " + color.RED.swigValue());
  15. System.out.println(" " + color.BLUE + " = " + color.BLUE.swigValue());
  16. System.out.println(" " + color.GREEN + " = " + color.GREEN.swigValue());
  17. System.out.println("\n*** Foo::speed ***");
  18. System.out.println(" Foo::" + Foo.speed.IMPULSE + " = " + Foo.speed.IMPULSE.swigValue());
  19. System.out.println(" Foo::" + Foo.speed.WARP + " = " + Foo.speed.WARP.swigValue());
  20. System.out.println(" Foo::" + Foo.speed.LUDICROUS + " = " + Foo.speed.LUDICROUS.swigValue());
  21. System.out.println("\nTesting use of enums with functions\n");
  22. example.enum_test(color.RED, Foo.speed.IMPULSE);
  23. example.enum_test(color.BLUE, Foo.speed.WARP);
  24. example.enum_test(color.GREEN, Foo.speed.LUDICROUS);
  25. System.out.println( "\nTesting use of enum with class method" );
  26. Foo f = new Foo();
  27. f.enum_test(Foo.speed.IMPULSE);
  28. f.enum_test(Foo.speed.WARP);
  29. f.enum_test(Foo.speed.LUDICROUS);
  30. }
  31. }