Skip to content

Commit cc58912

Browse files
committed
Refactor factory classes
1 parent 656ee87 commit cc58912

File tree

5 files changed

+53
-33
lines changed

5 files changed

+53
-33
lines changed
Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.language.programming.model;
22

3-
import com.language.programming.model.enumerations.WeaponType;
3+
import com.language.programming.model.factory.*;
44

55
public class Factory {
66

@@ -21,35 +21,3 @@ public Blacksmith getOrcBlacksmith() {
2121
}
2222

2323
}
24-
25-
class DwarfBlacksmith implements Blacksmith {
26-
27-
public Weapon forge(WeaponType weaponType) {
28-
return new Weapon(weaponType, 100f, 20f, 15f, 10f);
29-
}
30-
31-
}
32-
33-
class ElfBlacksmith implements Blacksmith {
34-
35-
public Weapon forge(WeaponType weaponType) {
36-
return new Weapon(weaponType, 100f, 30f, 10f, 6f);
37-
}
38-
39-
}
40-
41-
class HumanBlacksmith implements Blacksmith {
42-
43-
public Weapon forge(WeaponType weaponType) {
44-
return new Weapon(weaponType, 100f, 20f, 10f, 10f);
45-
}
46-
47-
}
48-
49-
class OrcBlacksmith implements Blacksmith {
50-
51-
public Weapon forge(WeaponType weaponType) {
52-
return new Weapon(weaponType, 100f, 40f, 30f, 15f);
53-
}
54-
55-
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.language.programming.model.factory;
2+
3+
import com.language.programming.model.Blacksmith;
4+
import com.language.programming.model.Weapon;
5+
import com.language.programming.model.enumerations.WeaponType;
6+
7+
public class DwarfBlacksmith implements Blacksmith {
8+
9+
public Weapon forge(WeaponType weaponType) {
10+
return new Weapon(weaponType, 100f, 20f, 15f, 10f);
11+
}
12+
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.language.programming.model.factory;
2+
3+
import com.language.programming.model.Blacksmith;
4+
import com.language.programming.model.Weapon;
5+
import com.language.programming.model.enumerations.WeaponType;
6+
7+
public class ElfBlacksmith implements Blacksmith {
8+
9+
public Weapon forge(WeaponType weaponType) {
10+
return new Weapon(weaponType, 100f, 30f, 10f, 6f);
11+
}
12+
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.language.programming.model.factory;
2+
3+
import com.language.programming.model.Blacksmith;
4+
import com.language.programming.model.Weapon;
5+
import com.language.programming.model.enumerations.WeaponType;
6+
7+
public class HumanBlacksmith implements Blacksmith {
8+
9+
public Weapon forge(WeaponType weaponType) {
10+
return new Weapon(weaponType, 100f, 20f, 10f, 10f);
11+
}
12+
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.language.programming.model.factory;
2+
3+
import com.language.programming.model.Blacksmith;
4+
import com.language.programming.model.Weapon;
5+
import com.language.programming.model.enumerations.WeaponType;
6+
7+
public class OrcBlacksmith implements Blacksmith {
8+
9+
public Weapon forge(WeaponType weaponType) {
10+
return new Weapon(weaponType, 100f, 40f, 30f, 15f);
11+
}
12+
13+
}

0 commit comments

Comments
 (0)