|
@@ -2,6 +2,7 @@ package agenda;
|
|
|
|
|
|
|
|
import java.io.Serializable;
|
|
import java.io.Serializable;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
|
+import java.util.Collections;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -19,6 +20,8 @@ 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(){
|
|
@@ -32,9 +35,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,11,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,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)));
|
|
|
|
|
|
|
|
//System.out.println(this);
|
|
//System.out.println(this);
|
|
|
}
|
|
}
|
|
@@ -50,7 +53,22 @@ public class Agenda implements Serializable {
|
|
|
public void addArtist(Artist artist){
|
|
public void addArtist(Artist artist){
|
|
|
this.artists.add(artist);
|
|
this.artists.add(artist);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * returns the first ActTime of all the acts.
|
|
|
|
|
+ * @return first ActTime of all acts
|
|
|
|
|
+ */
|
|
|
|
|
+ public ActTime firstActTime(){
|
|
|
|
|
+ List<Act> acts = this.getActs();
|
|
|
|
|
+ List<ActTime> actTimes = new ArrayList<ActTime>();
|
|
|
|
|
+ for(Act act: acts){
|
|
|
|
|
+ actTimes.add(act.getActTime());
|
|
|
|
|
+ }
|
|
|
|
|
+ Collections.sort(actTimes);
|
|
|
|
|
+ return actTimes.get(0);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
public void addAct(Act act){
|
|
public void addAct(Act act){
|
|
|
this.acts.add(act);
|
|
this.acts.add(act);
|
|
|
System.err.println(this.acts);
|
|
System.err.println(this.acts);
|