Может ли кто-нибудь объяснить, откуда будут входить эти скелетные коды.Запланированный календарь на Java
Скелет код выглядит следующим образом:
Data.java
import java.util.Date;
import java.util.List;
public interface Data {
// Return a list of all appointments at the given location (at any time)
// If there are no such appointments, return an empty list
// Throws IllegalArgumentException if the argument is null
public List<Schedule> getSchedule(String location);
// Return the next appointment at or after the given time (in any location)
// If there is no such appointment, return null
// Throws IllegalArgumentException if the argument is null
public Schedule getNextSchedule(Date when);
// Return the next appointment at or after the given time, at that location
// If there is no such appointment, return null
// Throws IllegalArgumentException if any argument is null
public Schedule getNextSchedule(Date when, String location);
// Create a new appointment in the calendar
// Throws IllegalArgumentException if any argument is null
public void add(String description, Date when, String location);
// Remove an appointment from the calendar
// Throws IllegalArgumentException if the argument is null
public void remove(Schedule schedule);
}
Calendar.java
import java.util.Date;
import java.util.List;
public class Calendar implements Data {
// We will use this when we test
public Calendar() {
}
@Override
public List<Schedule> getSchedule(String location) {
// TODO
return null;
}
@Override
public Schedule getNextSchedule(Date when) {
if(when == null) {
throw new IllegalArgumentException("time was null");
}
// TODO
return null;
}
@Override
public Schedule getNextSchedule(Date when, String location) {
// TODO
return null;
}
@Override
public void add(String description, Date when, String location) {
// TODO
}
@Override
public void remove(Schedule schedule) {
// TODO
}
}
Schedule.java
import java.util.Date;
public interface Schedule {
public String getDescription();
public String getLocation();
public Date getStartTime();
}
мне нравится
также знать:
- С чего начать, я попытался начать, но я не уверен, что вернуться в первый раздел todo, обозначенный getSchedule. Я знаю, что я не могу вернуть местоположение, потому что метод вызывает возврат типа List (?).
Я думаю, что было бы легче ответить на конкретный и четко заданный вопрос. Подумайте о конкретных вопросах, а не «объясните, что делает этот длинный код». – c0der
Точка, я добавил некоторые вопросы внизу, я буду продолжать добавлять больше, поскольку я продолжаю пытаться код. – Ryota
Ознакомьтесь с документацией о списках/коллекциях. – zapl