/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
2public class main {
3 static {
4 try {
5 System.loadLibrary("example");
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
12 public static void main(String argv[])
13 {
14 // Print out the value of some enums
15 System.out.println("*** color ***");
16 System.out.println(" RED = " + example.RED);
17 System.out.println(" BLUE = " + example.BLUE);
18 System.out.println(" GREEN = " + example.GREEN);
19
20 System.out.println("\n*** Foo::speed ***");
21 System.out.println(" Foo::IMPULSE = " + Foo.IMPULSE);
22 System.out.println(" Foo::WARP = " + Foo.WARP);
23 System.out.println(" Foo::LUDICROUS = " + Foo.LUDICROUS);
24
25 System.out.println("\nTesting use of enums with functions\n");
26
27 example.enum_test(example.RED, Foo.IMPULSE);
28 example.enum_test(example.BLUE, Foo.WARP);
29 example.enum_test(example.GREEN, Foo.LUDICROUS);
30 example.enum_test(1234,5678);
31
32 System.out.println( "\nTesting use of enum with class method" );
33 Foo f = new Foo();
34
35 f.enum_test(Foo.IMPULSE);
36 f.enum_test(Foo.WARP);
37 f.enum_test(Foo.LUDICROUS);
38 }
39}