Forget to add new Group file :)
This commit is contained in:
parent
6442ebdf19
commit
f290fca5ab
1 changed files with 47 additions and 0 deletions
47
src/be/jeffcheasey88/peeratcode/model/Group.java
Normal file
47
src/be/jeffcheasey88/peeratcode/model/Group.java
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
package be.jeffcheasey88.peeratcode.model;
|
||||||
|
|
||||||
|
import org.json.simple.JSONObject;
|
||||||
|
|
||||||
|
public class Group {
|
||||||
|
private String name;
|
||||||
|
private int linkToChapter;
|
||||||
|
private int linkToPuzzle;
|
||||||
|
|
||||||
|
public Group(String name, int initChap, int initPuzz) {
|
||||||
|
this.name = name;
|
||||||
|
this.linkToChapter = initChap;
|
||||||
|
this.linkToPuzzle = initPuzz;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLinkToChapter() {
|
||||||
|
return linkToChapter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLinkToChapter(int linkToChapter) {
|
||||||
|
this.linkToChapter = linkToChapter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLinkToPuzzle() {
|
||||||
|
return linkToPuzzle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLinkToPuzzle(int linkToPuzzle) {
|
||||||
|
this.linkToPuzzle = linkToPuzzle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JSONObject getJson() {
|
||||||
|
JSONObject groupJSON = new JSONObject();
|
||||||
|
groupJSON.put("name", name);
|
||||||
|
if (linkToChapter > 0) groupJSON.put("chapter", linkToChapter);
|
||||||
|
if (linkToPuzzle > 0) groupJSON.put("puzzle", linkToPuzzle);
|
||||||
|
return groupJSON;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue