Overview

This project is considered "CLOSED". Please visit the course web page for information regarding the open/closed policy for projects of this course.

For this project you will implement the data (or model) part of the MVC design pattern for a program that implements a marquee. A marquee is a display unit as seen in old theaters and sports arenas, where a message is formed from a series of blinking lights. By varying the arrangement of lights over time, the marquee can produce the effect that the text is being scrolled from right to left across the window. Your task in this project will be to implement this type of marquee. More details about the program are provided in the Specifications section. You may want to take a look at the Sample Run section before you read the description.

Objectives

To practice two-dimensional arrays.

Grading

Clarifications

Any clarifications or corrections associated with this project will be available at Clarifications

Code Distribution

The project's code distribution is available by checking out the project named Marquee. The code distribution provides you with the following:

Specifications

You will write a program that lets a user display a message in a marquee. The marquee display consists of a 2-dimensional array of cells where each cell can assume the colors red or white (see the Sample Run section). The program will prompt the user for a message to display, and will process that message so it can be moved across the display from right to left. For this homework we are providing the view and controller part of the MVC architecture, and you must implement the model part. In other words, we will do the displaying, but you need to implement what is to be displayed at each step of the animation.

Animations

In order to understand what you must implement, let's first overview how we can create animations. An animation consists of a sequence of still images, which are rapidly updated, and so creates the illusion of motion. The redrawing process is triggered by a timer event, which fires regularly at some small time interval (e.g., every 10th of a second).

How Does the Marquee Program Works

For this homework we have implemented two classes named MarqueeDisplay.java and MarqueeController.java. These classes implement the view and controller part of the MVC architecture respectively. The MarqueeDisplay class has a method named displayMessage(), which takes a two-dimensional array of cells and displays the array on the marquee display. The MarqueeController class implements a timer that calls the displayMessage() method of the MarqueeDisplay class, with a particular two-dimensional array of cells, at a particular rate.

Where does the array that is being displayed comes from? This is the result of calling a method named step(), which is defined in the class MarqueeDataManager. The MarqueeController class calls step() to obtain the next two-dimensional array to display. Each call produces a new 2-dimensional array, which has been shifted slightly relative to the prior one. This creates the illusion of motion. Your task for this homework is to implement the step() method. You do not need to modify the MarqueeDisplay or the MarqueeController class. If you define step() correctly, the support classes will take care of the rest.

Marquee Library

The cmscMarqueeLib has the support classes you need for this homework. The classes you will find in this package are:

Files

Your Assignment

Your assignment is to implement the MarqueeDataManager class. (Everything else is provided.) The class implements the DataManager interface therefore it must define the step() method. The step() method will return the next 2-dimensional array of Cell objects to display in the animation process. The MarqueeDataManager class must define a constructor with the following prototype:

public MarqueeDataManager(String message, int animationPattern);

The message parameter represents the message you want to display. The animationPattern is an integer that represents which animation pattern you are interested. We use 0 (zero) as the animation pattern for this homework. Students in the honor section will use this value to distiguish between the animation pattern for the homework and animation patterns for the honor part. Your constructor should set up the state of the MarqueeDataManager object so that every time the step() method is called, a 2-dimensional array of Cells representing the next stage in your animation is returned.

MarqueeDataManager step() Method Restrictions

The following restrictions must be observed as you implement the step() method:

Hints on Implementing the Marquee

You can follow any approach (algorithm) you understand is best in implementing the MarqueeDataManager class. The approach that we used in our implementation is based on a "sliding window" principle. Here is a general outline of the approach, and a figure is provided below to illustrate it.

Sample Run

Here is an example that show a couple of snapshots of the marquee as it displays the message "FEAR THE TURTLE". By the way in order to stop the marquee just close the display window.

sampleRunImage

sampleRunImage

sampleRunImage

sampleRunImage

sampleRunImage

Requirements

Additional Requirements for Students in Honors Section

Implement an animation pattern where your message moves top to buttom wrapping around in the process. You can assume the message will fit on the marquee display. Use number 1 to identify this pattern. In the Honor.java class, define a driver (similar to Marquee.java) that allow us to run your animation.