mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-16 20:59:07 +00:00
Formatted all files to the same standard
This commit is contained in:
@@ -6,13 +6,13 @@ import java.util.List;
|
||||
/**
|
||||
*
|
||||
* The class that needs many objects.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class AlchemistShop {
|
||||
|
||||
List<Potion> topShelf;
|
||||
List<Potion> bottomShelf;
|
||||
|
||||
|
||||
public AlchemistShop() {
|
||||
topShelf = new ArrayList<>();
|
||||
bottomShelf = new ArrayList<>();
|
||||
@@ -20,9 +20,9 @@ public class AlchemistShop {
|
||||
}
|
||||
|
||||
private void fillShelves() {
|
||||
|
||||
|
||||
PotionFactory factory = new PotionFactory();
|
||||
|
||||
|
||||
topShelf.add(factory.createPotion(PotionType.INVISIBILITY));
|
||||
topShelf.add(factory.createPotion(PotionType.INVISIBILITY));
|
||||
topShelf.add(factory.createPotion(PotionType.STRENGTH));
|
||||
@@ -31,27 +31,27 @@ public class AlchemistShop {
|
||||
topShelf.add(factory.createPotion(PotionType.STRENGTH));
|
||||
topShelf.add(factory.createPotion(PotionType.HEALING));
|
||||
topShelf.add(factory.createPotion(PotionType.HEALING));
|
||||
|
||||
|
||||
bottomShelf.add(factory.createPotion(PotionType.POISON));
|
||||
bottomShelf.add(factory.createPotion(PotionType.POISON));
|
||||
bottomShelf.add(factory.createPotion(PotionType.POISON));
|
||||
bottomShelf.add(factory.createPotion(PotionType.HOLY_WATER));
|
||||
bottomShelf.add(factory.createPotion(PotionType.HOLY_WATER));
|
||||
}
|
||||
|
||||
|
||||
public void enumerate() {
|
||||
|
||||
System.out.println("Enumerating top shelf potions\n");
|
||||
|
||||
for (Potion p: topShelf) {
|
||||
|
||||
for (Potion p : topShelf) {
|
||||
p.drink();
|
||||
}
|
||||
|
||||
|
||||
System.out.println("\nEnumerating bottom shelf potions\n");
|
||||
|
||||
for (Potion p: bottomShelf) {
|
||||
|
||||
for (Potion p : bottomShelf) {
|
||||
p.drink();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user