PageRenderTime 11ms CodeModel.GetById 2ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

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

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