Adapter (Chapter 3)
SOLUTION 3.1 | Your solution should look something like Figure B.2.
Figure B.2. This ShellAsRocket class relies on fireworks physics that can model a shell's apogee and “thrust” from its muzzle velocity. |
SOLUTION 3.2 | One set of solutions for the missing methods is:
package com.oozinoz.applications; import javax.swing.table.*; import com.oozinoz.fireworks.*; public class RocketTable extends AbstractTableModel { protected Rocket[] rockets; protected String[] columnNames = new String[] { "Name", "Price", "Apogee" }; public RocketTable(Rocket[] rockets) { this.rockets = rockets; } public int getColumnCount() { return columnNames.length; ... |
Get Design Patterns Java™ Workbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.