package appointmentplanner;
import java.util.Iterator;
public class Day {
private final int nr;
Node headlist = null;
private int day;
public final static Time dayStart = new Time(8, 30);
public final static Time dayEnd = new Time(17, 30);
public final static Time lunchTime = new Time(12, 30);
public final static TimeSpan dayPart = new TimeSpan(4, 0);
public final static Appointment linchBreak = new Appointment("lunch Break", new TimeSpan(1, 0));
public Day(int nr){
this.nr = nr;
}
public String getNameOfTheDay(){
switch(day){
case 1:
System.out.println("Monday");
break;
case 2:
System.out.println("Tuesday");
break;
case 3:
System.out.println("Wednesday");
break;
case 4:
System.out.println("Thursday");
break;
case 5:
System.out.println("Friday");
break;
case 6:
System.out.println("Suturday");
break;
case 7:
System.out.println("Sunday");
default:
System.out.println("Error: only Intergers between 1 and 7 are accepted");
}
return "Day: " + day;
}
public int getNrOfAppointments(){
return 0;
}
public boolean canAddAppointment(TimeSpan duration){
Node headlistCopy = headlist;
for (int i = 0; i < getNrOfAppointments(); i++) {
Appointment ap = headlistCopy.item;
// TODO...
if(duration.equals(ap.getDuration())){
System.out.println("schon verplant");
}else{
return true;
}
headlistCopy = headlistCopy.next;
}
return false;
}
public void setStartTimeForAppointment(Appointment appointment){
}
public void addAppointmentWithStartTimeSet(Appointment appointment){
}
public void removeAppointment(String description){
}
public Time[] getAvailableStartTimesForAppointmentsOfDuration ( TimeSpan duration ){
return null;
}
private static class Node<E> implements Iterator {
private Node<E> next;
private Appointment item;
Node(Appointment item, Node<E> next){
this.next = next;
this.item = item;
}
public Appointment getValue(){
return item;
}
public Node<E> getNext(){
return next;
}
public void setValue(Appointment item){
this.item = item;
}
public void setNext(Node<E> next){
this.next = next;
}
public boolean isEmpty(){
return item == null;
}
public void empty(){
item = null;
}
@Override
public String toString(){
return item + "";
}
@Override
public boolean hasNext() {
return true;
}
@Override
public Object next() {
return next;
}
}
}