Skip to content

Commit

Permalink
week 10 done
Browse files Browse the repository at this point in the history
  • Loading branch information
Almir Vucetovic committed Jan 17, 2022
1 parent 837ad61 commit e42205b
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/main/java/org/wahlzeit/model/Game.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.wahlzeit.model;

public class Game {

protected GameType gameType = null;

public Game(GameType gt){
gameType = gt;
}
}
16 changes: 16 additions & 0 deletions src/main/java/org/wahlzeit/model/GameManager.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.wahlzeit.model;

import java.util.ArrayList;

public class GameManager {

protected ArrayList<GameType> gameTypes;

public GameManager(){

}

public void addType(GameType gt){
gameTypes.add(gt);
}
}
6 changes: 5 additions & 1 deletion src/main/java/org/wahlzeit/model/GamePhoto.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

public class GamePhoto extends Photo{

private Game game = null;

public static final String IMAGE = "image";
public static final String THUMB = "thumb";
public static final String LINK = "link";
Expand Down Expand Up @@ -92,5 +94,7 @@ public GamePhoto(Location loc){
super(loc);
}


public void setGame(Game game) {
this.game = game;
}
}
3 changes: 3 additions & 0 deletions src/main/java/org/wahlzeit/model/GamePhotoManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ public class GamePhotoManager extends PhotoManager{
// photos, can be empty or filled
protected Map<PhotoId, GamePhoto> photoCache = new HashMap<>();


protected PhotoTagCollector photoTagCollector = null;

public GamePhotoManager() {
photoTagCollector = PhotoFactory.getInstance().createPhotoTagCollector();
}

public static PhotoManager initialize(){
return getInstance();
}
Expand All @@ -35,6 +37,7 @@ public static boolean hasPhoto(String id) {
return hasPhoto(PhotoId.getIdFromString(id));
}


//all methods stay the same because GamePhoto extends Photo so for all Photo instances GamePhoto can be used instead -> no need to change that

}
14 changes: 14 additions & 0 deletions src/main/java/org/wahlzeit/model/GameType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.wahlzeit.model;

public class GameType {

String type;

GameType(String type){
this.type = type;
}

public boolean isSubtype(GameType other){
return other instanceof GameType;
}
}

0 comments on commit e42205b

Please sign in to comment.