12.07.2015 Views

Podsumowanie wzorców projektowych GoF

Podsumowanie wzorców projektowych GoF

Podsumowanie wzorców projektowych GoF

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

}if (titleIn.equals(tempTitleAndActor.getTitle())) {actorsForTitle.add(tempTitleAndActor.getActor());}}return actorsForTitle;}public ArrayList getTitlesForActor(String actorIn) {ArrayList titlesForActor = new ArrayList();TitleAndActor tempTitleAndActor;ListIterator actorsAndTitlesIterator =titlesAndActors.listIterator();while (actorsAndTitlesIterator.hasNext()) {tempTitleAndActor =(TitleAndActor)actorsAndTitlesIterator.next();if (actorIn.equals(tempTitleAndActor.getActor())) {titlesForActor.add(tempTitleAndActor.getTitle());}}return titlesForActor;}DvdTitleActorExpressionpackage pk.dydakt.to.dp.b.gof.interpreter;import java.util.ArrayList;import java.util.ListIterator;public class DvdTitleActorExpression extends DvdAbstractExpression {String title;public DvdTitleActorExpression(String title) {this.title = title;}}public String interpret(DvdInterpreterContext dvdInterpreterContext) {ArrayList titlesAndActors =dvdInterpreterContext.getTitlesForActor(title);ListIterator titlesAndActorsIterator =titlesAndActors.listIterator();StringBuffer titleBuffer = new StringBuffer("");boolean first = true;while (titlesAndActorsIterator.hasNext()) {if (!first) {titleBuffer.append(", ");} else {first = false;}titleBuffer.append((String)titlesAndActorsIterator.next());}return titleBuffer.toString();}DvdTitleExpressionpackage pk.dydakt.to.dp.b.gof.interpreter;import java.util.ArrayList;import java.util.ListIterator;87

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!