Newer
Older
IrisServer / src / main / java / com / ntlab / irisserver / entities / Turn.java
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 int max;

    private List<List<Member>> questions = new ArrayList<>(); //<cno, List<Menber>>

    private List<Cell> openlist = new ArrayList<>();

    //コンストラクタ

    public Turn(){max = -1;}

    //---------------------------------------------------------
    //セッター

    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 String getHint() {return hint;}

    public String getTeam() {return team;}

    public int getMax() {return max;}

    public List<Cell> getOpenListAll() {return openlist;} //リストそのものを返す。

    public List<List<Member>> getQuestionsList() {return questions;}

    //---------------------------------------------------------
    //questions操作

    public List<Member> getQuestions(int cno){return questions.get(cno);}

    public void addQuestions(int cno, Member m){questions.get(cno).add(m);}

    public void delieteQuestions(int cno, Member m){
        List<Member> list = questions.get(cno);
        for(Iterator it = list.iterator(); it.hasNext();){
            Member member = (Member) it.next();
            if(member.getNickname() == m.getNickname()){
                it.remove();
                break;
            }
        }

    }

    public int sizeQuestions(){return questions.size();}

    //openlist操作

    public Cell getOpenListSolo(int num){return openlist.get(num);}

    public void addOpenList(Cell card){openlist.add(card);}

    public void delieteOpenList(int num){openlist.remove(num);}

    public int sizeOpenList(){return openlist.size();}


}