From f290fca5ab3a1e1b5770439e7eae110dec51abf6 Mon Sep 17 00:00:00 2001 From: Francois G Date: Mon, 20 Mar 2023 15:16:53 +0100 Subject: [PATCH] Forget to add new Group file :) --- .../jeffcheasey88/peeratcode/model/Group.java | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/be/jeffcheasey88/peeratcode/model/Group.java diff --git a/src/be/jeffcheasey88/peeratcode/model/Group.java b/src/be/jeffcheasey88/peeratcode/model/Group.java new file mode 100644 index 0000000..1a27bab --- /dev/null +++ b/src/be/jeffcheasey88/peeratcode/model/Group.java @@ -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; + } +}