2010-01-24 22:09:50 +01:00
|
|
|
package com.metaweb.gridlock.model;
|
|
|
|
|
2010-01-25 23:51:25 +01:00
|
|
|
import java.io.Serializable;
|
2010-01-27 02:48:42 +01:00
|
|
|
import java.util.Properties;
|
2010-01-25 23:51:25 +01:00
|
|
|
|
|
|
|
import org.json.JSONException;
|
|
|
|
import org.json.JSONObject;
|
|
|
|
|
2010-01-27 02:48:42 +01:00
|
|
|
import com.metaweb.gridlock.expr.HasFields;
|
|
|
|
|
|
|
|
public class Cell implements Serializable, HasFields {
|
2010-01-25 23:51:25 +01:00
|
|
|
private static final long serialVersionUID = -5891067829205458102L;
|
|
|
|
|
2010-01-24 22:09:50 +01:00
|
|
|
public Object value;
|
|
|
|
public Recon recon;
|
2010-01-25 23:51:25 +01:00
|
|
|
|
2010-01-27 02:48:42 +01:00
|
|
|
public JSONObject getJSON(Properties options) throws JSONException {
|
2010-01-25 23:51:25 +01:00
|
|
|
JSONObject o = new JSONObject();
|
|
|
|
|
|
|
|
o.put("v", value);
|
2010-01-27 02:48:42 +01:00
|
|
|
if (recon != null && options.containsKey("cell-recon")) {
|
|
|
|
o.put("recon", recon.getJSON(options));
|
|
|
|
}
|
2010-01-25 23:51:25 +01:00
|
|
|
|
|
|
|
return o;
|
|
|
|
}
|
2010-01-27 02:48:42 +01:00
|
|
|
|
|
|
|
@Override
|
2010-02-01 00:15:50 +01:00
|
|
|
public Object getField(String name, Properties bindings) {
|
2010-01-27 02:48:42 +01:00
|
|
|
if ("value".equals(name)) {
|
|
|
|
return value;
|
2010-02-01 00:15:50 +01:00
|
|
|
} else if ("recon".equals(name)) {
|
|
|
|
return recon;
|
2010-01-27 02:48:42 +01:00
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
2010-01-24 22:09:50 +01:00
|
|
|
}
|