updated flyweight sample

This commit is contained in:
Ilkka Seppala
2014-08-23 19:13:09 +03:00
parent db4625b9fe
commit f42c340598
7 changed files with 26 additions and 18 deletions

View File

@ -16,18 +16,23 @@ public class PotionFactory {
switch (type) {
case HEALING:
potion = new HealingPotion();
potions.put(type, potion);
break;
case HOLY_WATER:
potion = new HolyWaterPotion();
potions.put(type, potion);
break;
case INVISIBILITY:
potion = new InvisibilityPotion();
potions.put(type, potion);
break;
case POISON:
potion = new PoisonPotion();
potions.put(type, potion);
break;
case STRENGTH:
potion = new StrengthPotion();
potions.put(type, potion);
break;
default:
break;