Skip to content

Commit fa84672

Browse files
authored
code sections are updated in readme
1 parent c0bd818 commit fa84672

File tree

1 file changed

+32
-4
lines changed

1 file changed

+32
-4
lines changed

README.md

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,18 @@ Also, in this abstract class, we have set the accessibility of the behaviors req
2121
they should occur in a final method called createTheCar. Since the createTheCar method is final,
2222
the order of the production process is prevented from being interfered with by someone else. </br>
2323

24-
![UML](https://github.com/KeremTAN/CarFactory/blob/master/img/createrTheCar.png) </br>
24+
```java
25+
protected final void createTheCar(){
26+
System.out.println("... Car Producing Has Started ...");
27+
skeletonOfCar();
28+
engineProduce();
29+
wheelDriveSystemOfCar();
30+
seatsProduce();
31+
euroNCAPTest();
32+
System.out.println("A "+getCarColor()+ " "+getModelName()+" model vehicle was produced.");
33+
System.out.println("...........................\n");
34+
}
35+
```
2536

2637
We have separated our vehicles according to body types for production.
2738
While our vehicles are being produced, each case type stores its own vehicles in a static dataset.
@@ -34,11 +45,28 @@ Here, the iterator design pattern is used. In this way, we did not have to rewri
3445
While applying the Iterator design pattern, we wrote a method that returns Iterator. In this method, the ".iterator" property is used for datasets stored as List.
3546
Again, for the data stored as a raw array in this method, a class that implements the Iterator interface is written and an instance of that class is created.
3647

37-
![UML](https://github.com/KeremTAN/CarFactory/blob/master/img/theCarsList.png) </br>
48+
```java
49+
@Override
50+
public Iterator theCars() {
51+
return allHatchbackCars.iterator();
52+
}
53+
```
3854

39-
![UML](https://github.com/KeremTAN/CarFactory/blob/master/img/theCarsArray.png) </br>
55+
```java
56+
@Override
57+
public Iterator theCars() {
58+
return new CarsIterator(allConceptCars);
59+
}
60+
```
4061

41-
![UML](https://github.com/KeremTAN/CarFactory/blob/master/img/printCars.png) </br>
62+
```java
63+
public static void printCars(Iterator it) {
64+
while (it.hasNext()) {
65+
CarsProduction c = (CarsProduction) it.next();
66+
System.out.println(c.toString());
67+
}
68+
}
69+
```
4270

4371
### UML:
4472
#### Template Method Design Pattern

0 commit comments

Comments
 (0)