Added code comments.

This commit is contained in:
Ilkka Seppala
2015-04-15 22:29:04 +03:00
parent 27ff01de1b
commit 8062092291
16 changed files with 132 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
package com.iluwatar.magic;
import java.util.ArrayList;
import java.util.List;
import com.iluwatar.spell.Spell;
@@ -9,6 +10,11 @@ import com.iluwatar.spellbook.SpellbookDao;
import com.iluwatar.wizard.Wizard;
import com.iluwatar.wizard.WizardDao;
/**
*
* Service implementation.
*
*/
public class MagicServiceImpl implements MagicService {
private WizardDao wizardDao;
@@ -35,4 +41,17 @@ public class MagicServiceImpl implements MagicService {
public List<Spell> findAllSpells() {
return spellDao.findAll();
}
@Override
public List<Wizard> findWizardsWithSpellbook(String name) {
Spellbook spellbook = spellbookDao.findByName(name);
return new ArrayList<Wizard>(spellbook.getWizards());
}
@Override
public List<Wizard> findWizardsWithSpell(String name) {
Spell spell = spellDao.findByName(name);
Spellbook spellbook = spell.getSpellbook();
return new ArrayList<Wizard>(spellbook.getWizards());
}
}