PageRenderTime 51ms CodeModel.GetById 22ms RepoModel.GetById 0ms 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
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  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
  2. public class nspace_extend_runme {
  3. static {
  4. try {
  5. System.loadLibrary("nspace_extend");
  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. public static void main(String argv[]) {
  12. {
  13. // constructors and destructors
  14. nspace_extendPackage.Outer.Inner1.Color color1 = new nspace_extendPackage.Outer.Inner1.Color();
  15. nspace_extendPackage.Outer.Inner1.Color color = new nspace_extendPackage.Outer.Inner1.Color(color1);
  16. color1.delete();
  17. color1 = null;
  18. // class methods
  19. color.colorInstanceMethod(20.0);
  20. nspace_extendPackage.Outer.Inner1.Color.colorStaticMethod(20.0);
  21. nspace_extendPackage.Outer.Inner1.Color created = nspace_extendPackage.Outer.Inner1.Color.create();
  22. }
  23. {
  24. // constructors and destructors
  25. nspace_extendPackage.Outer.Inner2.Color color2 = new nspace_extendPackage.Outer.Inner2.Color();
  26. nspace_extendPackage.Outer.Inner2.Color color = new nspace_extendPackage.Outer.Inner2.Color(color2);
  27. color2.delete();
  28. color2 = null;
  29. // class methods
  30. color.colorInstanceMethod(20.0);
  31. nspace_extendPackage.Outer.Inner2.Color.colorStaticMethod(20.0);
  32. nspace_extendPackage.Outer.Inner2.Color created = nspace_extendPackage.Outer.Inner2.Color.create();
  33. // Same class different namespaces
  34. nspace_extendPackage.Outer.Inner1.Color col1 = new nspace_extendPackage.Outer.Inner1.Color();
  35. nspace_extendPackage.Outer.Inner2.Color col2 = nspace_extendPackage.Outer.Inner2.Color.create();
  36. col2.colors(col1, col1, col2, col2, col2);
  37. }
  38. }
  39. }