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-24 22:09:50 +01:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
|
2010-01-25 23:51:25 +01:00
|
|
|
import org.json.JSONException;
|
|
|
|
import org.json.JSONObject;
|
|
|
|
|
|
|
|
public class Row implements Serializable {
|
|
|
|
private static final long serialVersionUID = -689264211730915507L;
|
|
|
|
|
2010-01-24 22:09:50 +01:00
|
|
|
public boolean flagged;
|
|
|
|
public boolean starred;
|
|
|
|
public List<Cell> cells;
|
|
|
|
|
|
|
|
public Row(int cellCount) {
|
2010-01-25 23:51:25 +01:00
|
|
|
cells = new ArrayList<Cell>(cellCount);
|
|
|
|
}
|
|
|
|
|
|
|
|
public JSONObject getJSON() throws JSONException {
|
|
|
|
JSONObject o = new JSONObject();
|
|
|
|
|
|
|
|
List<JSONObject> a = new ArrayList<JSONObject>(cells.size());
|
|
|
|
for (Cell cell : cells) {
|
|
|
|
a.add(cell.getJSON());
|
|
|
|
}
|
|
|
|
o.put("cells", a);
|
|
|
|
o.put("flagged", flagged);
|
|
|
|
o.put("starred", starred);
|
|
|
|
|
|
|
|
return o;
|
2010-01-24 22:09:50 +01:00
|
|
|
}
|
|
|
|
}
|