2010-02-03 03:29:47 +01:00
|
|
|
package com.metaweb.gridworks.model;
|
2010-01-24 22:09:50 +01:00
|
|
|
|
2010-01-25 23:51:25 +01:00
|
|
|
import java.io.Serializable;
|
2010-02-03 01:20:42 +01:00
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.Map;
|
2010-01-27 02:48:42 +01:00
|
|
|
import java.util.Properties;
|
2010-01-25 23:51:25 +01:00
|
|
|
|
|
|
|
import org.json.JSONException;
|
2010-02-01 20:16:09 +01:00
|
|
|
import org.json.JSONWriter;
|
2010-01-25 23:51:25 +01:00
|
|
|
|
2010-02-03 03:29:47 +01:00
|
|
|
import com.metaweb.gridworks.Jsonizable;
|
2010-03-02 00:33:23 +01:00
|
|
|
import com.metaweb.gridworks.model.recon.ReconConfig;
|
2010-02-01 20:16:09 +01:00
|
|
|
|
|
|
|
public class Column implements Serializable, Jsonizable {
|
2010-01-25 23:51:25 +01:00
|
|
|
private static final long serialVersionUID = -1063342490951563563L;
|
|
|
|
|
2010-02-03 22:57:38 +01:00
|
|
|
final private int _cellIndex;
|
|
|
|
final private String _originalHeaderLabel;
|
|
|
|
private String _headerLabel;
|
2010-02-07 02:07:45 +01:00
|
|
|
private ReconConfig _reconConfig;
|
2010-02-27 00:33:16 +01:00
|
|
|
private ReconStats _reconStats;
|
2010-01-25 23:51:25 +01:00
|
|
|
|
2010-02-03 01:20:42 +01:00
|
|
|
transient protected Map<String, Object> _precomputes;
|
|
|
|
|
2010-02-03 22:57:38 +01:00
|
|
|
public Column(int cellIndex, String headerLabel) {
|
|
|
|
_cellIndex = cellIndex;
|
|
|
|
_originalHeaderLabel = _headerLabel = headerLabel;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getCellIndex() {
|
|
|
|
return _cellIndex;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getOriginalHeaderLabel() {
|
|
|
|
return _originalHeaderLabel;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setHeaderLabel(String headerLabel) {
|
|
|
|
this._headerLabel = headerLabel;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getHeaderLabel() {
|
|
|
|
return _headerLabel;
|
|
|
|
}
|
|
|
|
|
2010-02-07 02:07:45 +01:00
|
|
|
public void setReconConfig(ReconConfig config) {
|
|
|
|
this._reconConfig = config;
|
|
|
|
}
|
|
|
|
|
|
|
|
public ReconConfig getReconConfig() {
|
|
|
|
return _reconConfig;
|
|
|
|
}
|
|
|
|
|
2010-02-27 00:33:16 +01:00
|
|
|
public void setReconStats(ReconStats stats) {
|
|
|
|
this._reconStats = stats;
|
|
|
|
}
|
|
|
|
|
|
|
|
public ReconStats getReconStats() {
|
|
|
|
return _reconStats;
|
|
|
|
}
|
|
|
|
|
2010-02-01 20:16:09 +01:00
|
|
|
public void write(JSONWriter writer, Properties options)
|
|
|
|
throws JSONException {
|
2010-01-25 23:51:25 +01:00
|
|
|
|
2010-02-01 20:16:09 +01:00
|
|
|
writer.object();
|
2010-02-03 22:57:38 +01:00
|
|
|
writer.key("cellIndex"); writer.value(getCellIndex());
|
|
|
|
writer.key("headerLabel"); writer.value(getHeaderLabel());
|
2010-02-07 02:07:45 +01:00
|
|
|
if (_reconConfig != null) {
|
|
|
|
writer.key("reconConfig");
|
|
|
|
_reconConfig.write(writer, options);
|
|
|
|
}
|
2010-02-27 00:33:16 +01:00
|
|
|
if (_reconStats != null) {
|
|
|
|
writer.key("reconStats");
|
|
|
|
_reconStats.write(writer, options);
|
|
|
|
}
|
2010-02-01 20:16:09 +01:00
|
|
|
writer.endObject();
|
2010-01-25 23:51:25 +01:00
|
|
|
}
|
2010-02-03 01:20:42 +01:00
|
|
|
|
|
|
|
public void clearPrecomputes() {
|
|
|
|
if (_precomputes != null) {
|
|
|
|
_precomputes.clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public Object getPrecompute(String key) {
|
|
|
|
if (_precomputes != null) {
|
|
|
|
return _precomputes.get(key);
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setPrecompute(String key, Object value) {
|
|
|
|
if (_precomputes == null) {
|
|
|
|
_precomputes = new HashMap<String, Object>();
|
|
|
|
}
|
|
|
|
_precomputes.put(key, value);
|
|
|
|
}
|
2010-01-24 22:09:50 +01:00
|
|
|
}
|