-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathFroilansFarm.java
More file actions
51 lines (45 loc) · 1.99 KB
/
Copy pathFroilansFarm.java
File metadata and controls
51 lines (45 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package com.zipcodewilmington.froilansfarm;
import com.zipcodewilmington.froilansfarm.animals.Chicken;
import com.zipcodewilmington.froilansfarm.animals.Horse;
import com.zipcodewilmington.froilansfarm.crops.CornStalk;
import com.zipcodewilmington.froilansfarm.crops.PotatoRoot;
import com.zipcodewilmington.froilansfarm.crops.TomatoPlant;
import com.zipcodewilmington.froilansfarm.farm.*;
import com.zipcodewilmington.froilansfarm.vehicle.CropDuster;
import com.zipcodewilmington.froilansfarm.vehicle.Tractor;
public class FroilansFarm {
private static Farm farm;
private FroilansFarm() {
}
public static Farm getInstance() {
if (farm == null) {
farm = buildFarm();
return farm;
}
return farm;
}
private static Farm buildFarm() {
FarmBuilder builder = new FarmBuilder();
Farm farm = builder
.setFarmhouses(
new FarmHouse())
.setFields(
new Field(new CropRow(),
new CropRow(),
new CropRow(),
new CropRow(),
new CropRow()))
.setStables(
new Stable(new Horse(), new Horse(), new Horse()),
new Stable(new Horse(), new Horse(), new Horse(), new Horse()),
new Stable(new Horse(), new Horse(), new Horse()))
.setChickenCoops(
new ChickenCoop(new Chicken(), new Chicken(), new Chicken(), new Chicken()),
new ChickenCoop(new Chicken(), new Chicken(), new Chicken(), new Chicken()),
new ChickenCoop(new Chicken(), new Chicken(), new Chicken(), new Chicken()),
new ChickenCoop(new Chicken(), new Chicken(), new Chicken()))
.setVehicles(new Tractor(5), new CropDuster())
.build();
return farm;
}
}