| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- package agenda;
- import java.io.Serializable;
- import java.util.ArrayList;
- import java.util.Collections;
- import java.util.List;
- /**
- * Created by gjoosen on 06/02/15.
- */
- public class Agenda implements Serializable {
-
- private List<Stage> stages;
- private List<Artist> artists;
- private List<Act> acts;
-
- public Agenda() {
- this.stages = new ArrayList<Stage>();
- this.artists = new ArrayList<Artist>();
- this.acts = new ArrayList<Act>();
-
- this.testAgenda();
- System.out.println("first acttime: " + this.firstActTime());
- }
- private void testAgenda(){
- //stages
- this.stages.add(new Stage("Main stage"));
- this.stages.add(new Stage("Tent stage"));
-
- //artiesten
- this.artists.add(new Artist("Iron Maiden", "Heavy metal"));
- this.artists.add(new Artist("Slayer", "Tresh metal"));
- this.artists.add(new Artist("Sabaton", "Power metal"));
- //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)));
-
- //System.out.println(this);
- }
-
- public List<Stage> getStages() {
- return stages;
- }
- public void addStage(Stage stage){
- this.stages.add(stage);
- }
-
- public void addArtist(Artist 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){
- this.acts.add(act);
- System.err.println(this.acts);
- }
-
- public List<Artist> getArtists() {
- return artists;
- }
- public List<Act> getActs() {
- return acts;
- }
-
- public void removeStage(Object obj){
- this.stages.remove(obj);
- }
-
- public void removeArtist(Artist artist){
- this.artists.remove(artist);
- }
-
- public void removeAct(Act act){
- this.acts.remove(act);
- }
-
- @Override
- public String toString(){
- String string = "";
- for(Act act: this.acts){
- string += act + "\n\n";
- }
- return string;
- }
- }
|