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.

}break;}default : {abstractExpression = new DvdTitleExpression();break;}}break;}default : return result.toString();}}result.append(abstractExpression.interpret(dvdInterpreterContext));return result.toString();DvdAbstractExpressionpackage pk.dydakt.to.dp.b.gof.interpreter;public abstract class DvdAbstractExpression {public abstract String interpret(DvdInterpreterContext dvdInterpreterContext);}DvdActorExpressionpackage pk.dydakt.to.dp.b.gof.interpreter;import java.util.ArrayList;import java.util.ListIterator;public class DvdActorExpression extends DvdAbstractExpression {public String interpret(DvdInterpreterContext dvdInterpreterContext) {ArrayList actors = dvdInterpreterContext.getAllActors();ListIterator actorsIterator = actors.listIterator();StringBuffer titleBuffer = new StringBuffer("");boolean first = true;while (actorsIterator.hasNext()) {if (!first) {titleBuffer.append(", ");} else {first = false;}titleBuffer.append((String)actorsIterator.next());}return titleBuffer.toString();}}DvdActorTitleExpressionpackage pk.dydakt.to.dp.b.gof.interpreter;import java.util.ArrayList;import java.util.ListIterator;public class DvdActorTitleExpression extends DvdAbstractExpression {85

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

Saved successfully!

Ooh no, something went wrong!