CSC407F Assignment #1

Page Breaker

Due: October 18 (in drop-off box by 5:00 p.m.)


Write a program in Java that takes as input an arbitrary text file and outputs essentially the same file, but with extra blank lines added in such a way that page-breaks occur at convenient locations.

The command-line syntax you will use to execute your program is as follows.

java PageBreaker [-h] [-l lines] [-a algorithm]

In deciding where to break pages, you should support at least the following four algorithms.

An important consideration in your design should be the ability to add new algorithms very easily, and to be able to combine these algorithms. You should program with the view of eventually being able to support the dynamic loading of new algorithms and the ability to write a little expression in place of algorithm that can combine loaded algorithms, although it is not necessary to implement either of these features now.

Note that this task has many similarities to LEXI. You should study that design for inspiration, and consider the use of the patterns Strategy, Abstract Factory, Iterator, and Visitor, amongst others.

You are to hand in the following work products:

You will be marked based upon the following criteria (25% each):

Note that if the quality of the UML, writeup, and/or source code are so poor as to force the TA to dig to find the design and patterns, you will receive low marks on the design and patterns portion as well.

Bonus

Two independent bonuses are available, each worth an absolute +5%.

The bonuses will be marked on the same basis as the main assignment.