package calendar;

import java.util.Calendar;

public class ScheduleModel {
 
 private final long MILLIS_IN_DAY = 1000 * 60 * 60 * 24;
 
 private int year;
 private int month;
 private int date;
 private String content;
 
 // CONSTRUCTOR
 public ScheduleModel(int year, int month, int date, String content) {
  this.year = year;
  this.month = month;
  this.date = date;
  this.content = content;
 }

 // CONSTRUCTOR
 public ScheduleModel(String line) {
  int index = line.indexOf("[");
  String[] date = line.substring(index + 1, index + 11).split("-");
  System.out.println(date[0] + "/" + date[1] + "/" + date[2]);
  String con = line.substring(index + 13);
  this.year = Integer.parseInt(date[0]);
  this.month = Integer.parseInt(date[1]);
  this.date = Integer.parseInt(date[2]);
  this.content = con;
 }
 
 // Getter / Setter
 public int getYear() {
  return year;
 }
 
 public void setYear(int year) {
  this.year = year;
 }
 
 public int getMonth() {
  return month;
 }
 
 public void setMonth(int month) {
  this.month = month;
 }
 
 public int getDate() {
  return date;
 }
 
 public void setDate(int date) {
  this.date = date;
 }
 
 public String getContent() {
  return content;
 }
 
 public void setContent(String content) {
  this.content = content;
 }
 
 public String toDdayString(Calendar today) {
  long todayTime = today.getTimeInMillis();
  
  Calendar cal = Calendar.getInstance();
  cal.set(year, month - 1, date);
  long modelTime = cal.getTimeInMillis();
  
  String dday = "D";
  if (modelTime > todayTime) {
   // D-()
   int temp = (int) Math.floor((modelTime - todayTime) / MILLIS_IN_DAY);
   dday += ("-" + temp);
  }
  else if (modelTime < todayTime) {
   // D+()
   int temp = (int) Math.floor((todayTime - modelTime) / MILLIS_IN_DAY);
   dday += ("+" + temp);
  }
  else {
   // D-DAY
   dday += "-DAY";
  }
  return String.format("(%s) [d-d-d] %s", dday, year, month, date, content);
 }

 @Override
 public String toString() {
  return String.format("[d-d-d] %s", year, month, date, content);
 }

 @Override
 public boolean equals(Object comparer) {
  ScheduleModel model = (ScheduleModel)comparer;
  return this.year == model.year &&
    this.month == model.month &&
    this.date == model.date &&
    this.content.equals(model.content);
 }
}


캘린더 프로그램에 d-day기능을 넣은 부분 관련인데 java 생 초짜이다 보니 해석이 안되네요

해석좀 해주실 수 있는분 안계신가요.. hwich@icloud.com 이쪽으로 보내주시면 기프티콘이라도 보내드리겠습니다.ㅠㅠ