|
@@ -4,6 +4,8 @@ import mdd.client.GUIEventHandler;
|
|
|
import mdd.client.IGUIEventClient;
|
|
|
import org.json.simple.JSONArray;
|
|
|
import org.json.simple.JSONObject;
|
|
|
+import org.json.simple.parser.JSONParser;
|
|
|
+import org.json.simple.parser.ParseException;
|
|
|
|
|
|
import java.util.*;
|
|
|
|
|
@@ -82,10 +84,10 @@ public class Permutation implements IData, IGUIEventClient {
|
|
|
protected void configure(JSONObject json){
|
|
|
if(json.containsKey("status")){
|
|
|
switch(json.get("status").toString()){
|
|
|
- case "ok":
|
|
|
+ case "1":
|
|
|
setValue("status", 1.0);
|
|
|
break;
|
|
|
- case "error":
|
|
|
+ case "-1":
|
|
|
setValue("status", -1.0);
|
|
|
break;
|
|
|
default:
|
|
@@ -93,14 +95,23 @@ public class Permutation implements IData, IGUIEventClient {
|
|
|
}
|
|
|
}
|
|
|
if(json.containsKey("fitness")){
|
|
|
- setValue("fitness", (double)json.get("fitness"));
|
|
|
+ setValue("fitness", Double.valueOf(json.get("fitness").toString()));
|
|
|
}
|
|
|
if(json.containsKey("time")){
|
|
|
- setValue("time", (double)json.get("time"));
|
|
|
+ setValue("time", Double.valueOf(json.get("time").toString()));
|
|
|
+ //setValue("time", (double)json.get("time"));
|
|
|
}
|
|
|
if (jdna == null){
|
|
|
if(json.containsKey("dna")){
|
|
|
- jdna = (JSONArray)json.get("dna");
|
|
|
+ JSONParser parser = new JSONParser();
|
|
|
+ try {
|
|
|
+ //jdna = (JSONArray)json.get("dna");
|
|
|
+ jdna = (JSONArray)parser.parse(json.get("dna").toString());
|
|
|
+ }
|
|
|
+ catch (ParseException e){
|
|
|
+ jdna = (JSONArray)json.get("dna");
|
|
|
+ }
|
|
|
+
|
|
|
for (int i = 0; i < jdna.size(); ++i){
|
|
|
JSONArray params = (JSONArray) jdna.get(i);
|
|
|
for (int j = 0; j < params.size(); ++j){
|