Newer
Older
CitrusClient / app / src / main / java / com / example / citrusclient / models / Todo.java
package com.example.citrusclient.models;

import java.util.List;

public class Todo {

    String title;
    boolean check;
    int year;
    int month;
    int day;
    Integer todoId;
    Integer bookId;

    //コンストラクタ
    public Todo(String title, boolean check, int year, int month, int day, Integer tid, Integer bid) {
        this.title = title;
        this.check = check;
        this.year = year;
        this.month = month;
        this.day = day;
        todoId = tid;
        this.bookId = bid;
    }

    public Todo(){}



    //セッター
    public void setTitle(String title) {this.title = title;}
    public void setCheck(boolean check) {this.check = check;}
    public void setYear(int year) {this.year = year;}
    public void setMonth(int month) {this.month = month;}
    public void setDay(int day) {this.day = day;}
    public void setTodoId(Integer tid) {this.todoId = tid;}
    public void setBookId(Integer bid) {this.bookId = bid; }

    //ゲッター
    public String getTitle() {return title;}

    public boolean getCheck() {return check;}

    public int getYear() {return year;}

    public int getMonth() {return month;}

    public int getDay() {return day;}

    public Integer getTodoId() {
        return todoId;
    }
    public Integer getBookId(){return bookId;}

    public boolean containsTodo(List<Todo> todoList){
        for(Todo todo : todoList) {
            if(todo.bookId == this.bookId && todo.year == this.year && todo.month == this.month && todo.day == this.day && todo.todoId == this.todoId) {
                return true;
            }
        }
        return false;
    }
}