package com.ntlab.irisserver.entities; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.ArrayList; import java.util.List; import java.util.Iterator; public class Turn { @JsonProperty("hint") private String hint; @JsonProperty("team") private String team; @JsonProperty("max") private Integer max; @JsonProperty("turnstate") private int turnstate; //0:スパイマスターのターン 1:諜報員のターン @JsonProperty("endstate") private int endstate;//0:game継続, 1:game終了 private Boolean[] questions = new Boolean[16] ;//<cno, 空いているかどうかt:f>> private List<Integer> openlist = new ArrayList<>(); //コンストラクタ public Turn(){ turnstate = 0; endstate = 0; int i; for(i = 0; i < 16; i++)questions[i] = false; } //--------------------------------------------------------- //セッター public void setHint(String hint) {this.hint = hint;} public void setTeam(String team) {this.team = team;} public void setMax(int max) {this.max = max;} public void setTurnstate(int turnstate) {this.turnstate = turnstate;} public void setEndstate(int endstate) {this.endstate = endstate;} //--------------------------------------------------------- //ゲッター public String getHint() {return hint;} public String getTeam() {return team;} public int getMax() {return max;} public List<Integer> getOpenListAll() {return openlist;} //リストそのものを返す。 public Boolean[] getQuestionsList() {return questions;} public int getTurnstate() {return turnstate;} public int getEndstate() {return endstate;} //--------------------------------------------------------- //questions操作 public boolean getQuestions(int cno){return questions[cno];} public void setQuestions(int cno){questions[cno] = !questions[cno];} /* public void delieteQuestions(int cno, Member m){ List<Member> list = questions[cno]; for(Iterator it = list.iterator(); it.hasNext();){ Member member = (Member) it.next(); if(member.getNickname() == m.getNickname()){ it.remove(); break; } } } public int sizeQuestions(int cno){return questions[cno].size();} */ //openlist操作 public Integer getOpenListSolo(int num){return openlist.get(num);} public void addOpenList(Integer cno){openlist.add(cno);} public void delieteOpenList(int num){openlist.remove(num);} public int sizeOpenList(){return openlist.size();} }