Lootpool scripts added

Data transfer from py script to java
This commit is contained in:
CharonInferar
2014-04-08 15:39:48 +02:00
parent d848e89edb
commit 70964ef14a
13 changed files with 175 additions and 72 deletions
+23
View File
@@ -21,6 +21,9 @@
******************************************************************************/
package services;
import java.util.Iterator;
import java.util.Vector;
import org.python.core.Py;
import org.python.core.PyObject;
import org.python.util.PythonInterpreter;
@@ -107,4 +110,24 @@ public class ScriptService {
return func;
}
public Vector<String> fetchStringVector(String path, String method) {
Vector<String> vector = new Vector<String>();
PyObject result = core.scriptService.callScript(path, "", method);
Iterable<PyObject> comp = (Iterable<PyObject>)result.asIterable();
for (Iterator<PyObject> temp = comp.iterator(); temp.hasNext();){
vector.add(temp.next().asString());
}
return vector;
}
public Vector<Integer> fetchIntegerVector(String path, String method) {
Vector<Integer> vector = new Vector<Integer>();
PyObject result = core.scriptService.callScript(path, "", method);
Iterable<PyObject> comp = (Iterable<PyObject>)result.asIterable();
for (Iterator<PyObject> temp = comp.iterator(); temp.hasNext();){
vector.add(temp.next().asInt());
}
return vector;
}
}