/
niceSOFT
/
swig
Обзор
Документация
Войти
/
niceSOFT
/
swig
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Examples/test-suite/java/director_string_runme.java
57 строк
2 KB
Olly Betts
Expand director_string_runme.*
21 дек 2023, 00:59
21 дек 2023, 00:59
ccaf462
Код
Авторство
О чём код?
import director_string.*; public class director_string_runme { static { try { System.loadLibrary("director_string"); } catch (UnsatisfiedLinkError e) { 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); System.exit(1); } } public static void main(String argv[]) { String s; director_string_A c = new director_string_A("hi"); for (int i=0; i<3; i++) { s = c.call_get(i); if (!s.equals(Integer.valueOf(i).toString())) throw new RuntimeException("director_string_A.get(" + i + ") failed. Got:" + s); } director_string_B b = new director_string_B("hello"); s = b.get_first(); if (!s.equals("director_string_B.get_first")) throw new RuntimeException("get_first() failed"); s = b.call_get_first(); if (!s.equals("director_string_B.get_first")) throw new RuntimeException("call_get_first() failed"); s = b.call_get(0); if (!s.equals("director_string_B.get: hello")) throw new RuntimeException("get(0) failed"); } } class director_string_B extends A { public director_string_B(String first) { super(first); } public String get_first() { return "director_string_B.get_first"; } public String get(int n) { return "director_string_B.get: " + super.get(n); } } class director_string_A extends A { public director_string_A(String first) { super(first); } public String get(int n) { return Integer.valueOf(n).toString(); } }