PageRenderTime 32ms CodeModel.GetById 19ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

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

#
Java | 44 lines | 33 code | 5 blank | 6 comment | 0 complexity | fca2fb2ac659d1be24cae1ea133902de MD5 | raw file
 1// This tests changes the package name from nspace to nspacePackage as javac can't seem to resolve classes and packages having the same name
 2public class nspace_extend_runme {
 3
 4  static {
 5    try {
 6	System.loadLibrary("nspace_extend");
 7    } catch (UnsatisfiedLinkError e) {
 8      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);
 9      System.exit(1);
10    }
11  }
12
13  public static void main(String argv[]) {
14    {
15      // constructors and destructors
16      nspace_extendPackage.Outer.Inner1.Color color1 = new nspace_extendPackage.Outer.Inner1.Color();
17      nspace_extendPackage.Outer.Inner1.Color color = new nspace_extendPackage.Outer.Inner1.Color(color1);
18      color1.delete();
19      color1 = null;
20
21      // class methods
22      color.colorInstanceMethod(20.0);
23      nspace_extendPackage.Outer.Inner1.Color.colorStaticMethod(20.0);
24      nspace_extendPackage.Outer.Inner1.Color created = nspace_extendPackage.Outer.Inner1.Color.create();
25    }
26    {
27      // constructors and destructors
28      nspace_extendPackage.Outer.Inner2.Color color2 = new nspace_extendPackage.Outer.Inner2.Color();
29      nspace_extendPackage.Outer.Inner2.Color color = new nspace_extendPackage.Outer.Inner2.Color(color2);
30      color2.delete();
31      color2 = null;
32
33      // class methods
34      color.colorInstanceMethod(20.0);
35      nspace_extendPackage.Outer.Inner2.Color.colorStaticMethod(20.0);
36      nspace_extendPackage.Outer.Inner2.Color created = nspace_extendPackage.Outer.Inner2.Color.create();
37
38      // Same class different namespaces
39      nspace_extendPackage.Outer.Inner1.Color col1 = new nspace_extendPackage.Outer.Inner1.Color();
40      nspace_extendPackage.Outer.Inner2.Color col2 = nspace_extendPackage.Outer.Inner2.Color.create();
41      col2.colors(col1, col1, col2, col2, col2);
42    }
43  }
44}