|
@@ -1,8 +1,11 @@
|
|
|
package agenda;
|
|
package agenda;
|
|
|
|
|
|
|
|
|
|
+import sun.util.calendar.Gregorian;
|
|
|
|
|
+
|
|
|
import java.io.Serializable;
|
|
import java.io.Serializable;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
import java.util.Collections;
|
|
import java.util.Collections;
|
|
|
|
|
+import java.util.GregorianCalendar;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -20,8 +23,6 @@ public class Agenda implements Serializable {
|
|
|
this.acts = new ArrayList<Act>();
|
|
this.acts = new ArrayList<Act>();
|
|
|
|
|
|
|
|
this.testAgenda();
|
|
this.testAgenda();
|
|
|
-
|
|
|
|
|
- System.out.println("first acttime: " + this.firstActTime());
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void testAgenda(){
|
|
private void testAgenda(){
|
|
@@ -35,9 +36,9 @@ public class Agenda implements Serializable {
|
|
|
this.artists.add(new Artist("Sabaton", "Power metal"));
|
|
this.artists.add(new Artist("Sabaton", "Power metal"));
|
|
|
|
|
|
|
|
//acts
|
|
//acts
|
|
|
- this.acts.add(new Act(this.artists.get(0).getName(), this.stages.get(0), "Heavy metal", new ActTime(2015,02,11,21,00 ,2015,02,11,23,00), 5, this.artists.get(0)));
|
|
|
|
|
- this.acts.add(new Act(this.artists.get(1).getName(), this.stages.get(1), "Test metal" , new ActTime(2015,02,10,23,00 ,2015,02,12,04,30), 5, this.artists.get(1)));
|
|
|
|
|
- this.acts.add(new Act(this.artists.get(2).getName(), this.stages.get(0), "Power metal" ,new ActTime(2015,02,11,20,00 ,2015,02,11,23,00), 4, this.artists.get(2)));
|
|
|
|
|
|
|
+ this.acts.add(new Act(this.artists.get(0).getName(), this.stages.get(0), "Heavy metal", new ActTime(2015,02,11,21,00 ,2015,02,11,23,12), 5, this.artists.get(0)));
|
|
|
|
|
+ this.acts.add(new Act(this.artists.get(1).getName(), this.stages.get(1), "Test metal", new ActTime(2016, 02, 10, 23, 00, 2016, 02, 12, 04, 30), 5, this.artists.get(1)));
|
|
|
|
|
+ this.acts.add(new Act(this.artists.get(2).getName(), this.stages.get(0), "Power metal", new ActTime(2015, 02, 11, 20, 00, 2015, 02, 11, 23, 00), 4, this.artists.get(2)));
|
|
|
|
|
|
|
|
//System.out.println(this);
|
|
//System.out.println(this);
|
|
|
}
|
|
}
|
|
@@ -68,6 +69,21 @@ public class Agenda implements Serializable {
|
|
|
return actTimes.get(0);
|
|
return actTimes.get(0);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param time GregorianCalendar, remember month -1!
|
|
|
|
|
+ * @return list of acts that are planned at the time.
|
|
|
|
|
+ */
|
|
|
|
|
+ public List<Act> getCurrentActs(GregorianCalendar time){
|
|
|
|
|
+ List<Act> currentActs = new ArrayList<>();
|
|
|
|
|
+ for(Act act: this.acts){
|
|
|
|
|
+ if(act.getActTime().contains(time)){
|
|
|
|
|
+ currentActs.add(act);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return currentActs;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
public void addAct(Act act){
|
|
public void addAct(Act act){
|
|
|
this.acts.add(act);
|
|
this.acts.add(act);
|