Question: Exercises 1 2 . 3 - 1 2 . 8 are related. Do the exercises in sequence. The following are tentative specifications for a simple

Exercises 12.3-12.8 are related. Do the exercises in sequence. The following are tentative specifications for a simple diagram editor that could be used as the core of a variety of applications.
The editor will be used interactively to create and modify drawings. A drawing contains several sheets. Drawings are saved to and loaded from named ASCII files. Sheets contain boxes and links. Each box may optionally contain a single line of text. Text is allowed only in boxes. The editor must automatically adjust the size of a box to fit any enclosed text. The font size of the text is not adjustable. Any pair of boxes on the same sheet may be linked by a series of alternating horizontal and vertical lines. Figure E12.1 shows a simple, one sheet drawing.
The editor will be menu driven, with pop-up menus. A three-button mouse will be used for menu, object, and link selections. The following are some operations the editor should provide: create sheet, delete sheet, next sheet, previous sheet, create box, link boxes, enter text, group selection, cut selections, move selections, copy selections, paste, edit text, save drawing, and load drawing. Copy, cut,
208
Chapter 12/ Domain Analysis
and paste will work through a buffer. Copy will create a copy of selections from a sheet to the buffer. Cut will remove selections to the buffer. Paste will copy the contents of the buffer to the sheet. Each copy and cut operation overwrites the previous contents of the buffer. Pan and zoom will not be allowed; sheets will have fixed size. When boxes are moved, enclosed text should move with them and links should be stretched.
12.3(3) The following is a list of candidate classes. Prepare a list of classes that should be eliminated for any of the reasons given in this chapter. Give a reason for each elimination. If there is more than one reason, give the main one.
character, line, x coordinate, y coordinate, link, position, length, width, collection, selection, menu, mouse, button, computer, drawing, drawing file, sheet, pop-up, point, menu item, selected object, selected line, selected box, selected text, file name, box, buffer, line segment coordinate, connection, text, name, origin, scale factor, corner point, end point, graphics object.
12.4(3) Prepare a data dictionary for proper classes from the previous exercise.
12.5(3) The following is a list of candidate associations and generalizations for the diagram editor. Prepare a list of associations and generalizations that should be eliminated or renamed for any of the reasons given in this chapter. Give a reason for each elimination or renaming. If there is more than one reason, give the main one.
a box has text, a box has a position, a link logically associates two boxes, a box is moved, a link has points, a link is defined by a sequence of points, a selection or a buffer or a sheet is a collection, a character string has a location, a box has a character string, a character string has characters, a line has length, a collection is composed of links and boxes, a link is deleted, a line is moved, a line is a graphical object, a point is a graphical object, a line has two points, a point has an x coordinate, a point has a y coordinate
12.6 Figure E12.2 is a partially completed class diagram for the diagram editor. Show how could it be used for each of the following queries. Use a combination of the OCL (see Chapter 3) and pseudocode to express your queries.
a.(2) Find all selected boxes and links.
b.(4) Given a box, determine all other boxes that are directly linked to it.
c.(8) Given a box, find all other boxes that are directly or indirectly linked to it.
d.(2) Given a box and a link, determine if the link involves the box.
e.(3) Given a box and a link, find the other box logically connected to the given box through the other end of the link.
f.(4) Given two boxes, determine all links between them.
g.(6) Given a selection, determine which links are "bridging" links. If a selection does not include all boxes on a sheet, "bridging" links may result. A "bridging" link is a link that con-Exercises
209
nects a box that has been selected to a box that has not. A link that connects two boxes that are selected or two boxes that are not selected is not a "bridging" link. "Bridging" links require special handling during a cut or a move operation on a selection.
12.7(6) Figure E12.3 is a variation of the class diagram in which the class Connection explicitly represents the connection of a link to a box. Redo the queries from the previous exercise using this representation.
rigure ciL. A Aternative partiany compieted ciass alagram ior a diagram eaitor
12.8(5) What classes require state diagrams? Describe some relevant states and events.
Exercises 12.9-12.13 are related. Do the exercises in sequence. These exercises concern a computerized scoring system that you
Exercises 1 2 . 3 - 1 2 . 8 are related. Do the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!