100% found this document useful (1 vote)
7 views

(eBook PDF) Data Structures and Other Objects Using Java 4th Edition download

The document provides links to various eBooks on data structures and Java programming, including multiple editions of titles focused on data structures, problem-solving, and object-oriented programming. It outlines a structured approach to teaching data types, their specifications, implementations, and analyses, emphasizing the importance of understanding data structures in Java. Additionally, it discusses advanced projects and flexibility in course material ordering to cater to different student backgrounds and learning paces.

Uploaded by

vsofdxgoh2433
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
7 views

(eBook PDF) Data Structures and Other Objects Using Java 4th Edition download

The document provides links to various eBooks on data structures and Java programming, including multiple editions of titles focused on data structures, problem-solving, and object-oriented programming. It outlines a structured approach to teaching data types, their specifications, implementations, and analyses, emphasizing the importance of understanding data structures in Java. Additionally, it discusses advanced projects and flexibility in course material ordering to cater to different student backgrounds and learning paces.

Uploaded by

vsofdxgoh2433
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 48

(eBook PDF) Data Structures and Other Objects

Using Java 4th Edition download

https://ebookluna.com/product/ebook-pdf-data-structures-and-
other-objects-using-java-4th-edition/

Download full version ebook from https://ebookluna.com


We believe these products will be a great fit for you. Click
the link to download now, or visit ebookluna.com
to discover even more!

(eBook PDF) Data Structures and Problem Solving Using Java 4th Edition

https://ebookluna.com/product/ebook-pdf-data-structures-and-problem-
solving-using-java-4th-edition/

(eBook PDF) Data Structures and Abstractions with Java 4th Edition

https://ebookluna.com/product/ebook-pdf-data-structures-and-abstractions-
with-java-4th-edition/

(eBook PDF) Data Structures and Abstractions with Java 4th Global Edition

https://ebookluna.com/product/ebook-pdf-data-structures-and-abstractions-
with-java-4th-global-edition/

(eBook PDF) Starting Out with Java: From Control Structures through Data
Structures 4th Edition

https://ebookluna.com/product/ebook-pdf-starting-out-with-java-from-
control-structures-through-data-structures-4th-edition/
Data Structures and Abstractions with Java 5th Edition (eBook PDF)

https://ebookluna.com/product/data-structures-and-abstractions-with-
java-5th-edition-ebook-pdf/

(eBook PDF) Starting Out with Java: From Control Structures through
Objects, 7th Edition

https://ebookluna.com/product/ebook-pdf-starting-out-with-java-from-
control-structures-through-objects-7th-edition/

(eBook PDF) Starting Out with Java: From Control Structures through Data
Structures 3rd Edition

https://ebookluna.com/product/ebook-pdf-starting-out-with-java-from-
control-structures-through-data-structures-3rd-edition/

(eBook PDF) Introduction to JAVA Programming and Data Structures


Comprehensive Version 11

https://ebookluna.com/product/ebook-pdf-introduction-to-java-programming-
and-data-structures-comprehensive-version-11/

(eBook PDF) Java Foundations: Introduction to Program Design and Data


Structures 5th Edition

https://ebookluna.com/product/ebook-pdf-java-foundations-introduction-to-
program-design-and-data-structures-5th-edition/
Preface vii

each method is presented along with a precondition/postcondition contract that


completely specifies the behavior of the method. At this level, it’s important for
the students to realize that the specification is not tied to any particular choice of
implementation techniques. In fact, this same specification may be used several
times for several different implementations of the same data type.

Step 3: Use the Data Type. With the specification in place, students can write
small applications or applets to show the data type in use. These applications are
based solely on the data type’s specification because we still have not tied down
the implementation.

Step 4: Select Appropriate Data Structures and Proceed to Design and


Implement the Data Type. With a good abstract understanding of the data
type, we can select an appropriate data structure, such as an array, a linked list of
nodes, or a binary tree of nodes. For many of our data types, a first design and
implementation will select a simple approach, such as an array. Later, we will
redesign and reimplement the same data type with a more complicated underly-
ing structure.
Because we are using Java classes, an implementation of a data type will have
the selected data structures (arrays, references to other objects, etc.) as private
instance variables of the class. In my own teaching, I stress the necessity for a
clear understanding of the rules that relate the private instance variables to the
abstract notion of the data type. I require each student to write these rules in clear
English sentences that are called the invariant of the abstract data type. Once the
invariant is written, students can proceed to implementing various methods. The
invariant helps in writing correct methods because of two facts: (a) Each method
(except the constructors) knows that the invariant is true when the method begins
its work; and (b) each method is responsible for ensuring that the invariant is
again true when the method finishes.

Step 5: Analyze the Implementation. Each implementation can be analyzed


for correctness, flexibility, and time analysis of the operations (using big-O
notation). Students have a particularly strong opportunity for these analyses
when the same data type has been implemented in several different ways.

Where Will the Students Be at the End of the Course?


At the end of our course, students understand the data types inside out. They
know how to use the data types and how to implement them in several ways.
They know the practical effects of the different implementation choices. The
students can reason about efficiency with a big-O analysis and can argue for the
correctness of their implementations by referring to the invariant of the ADT.
viii Preface

the data types in One of the lasting effects of the course is the specification, design, and imple-
this book are mentation experience. The improved ability to reason about programs is also
cut-down important. But perhaps most important of all is the exposure to classes that are
versions of the easily used in many situations. The students no longer have to write everything
Java Class from scratch. We tell our students that someday they will be thinking about a
Libraries problem, and they will suddenly realize that a large chunk of the work can be
done with a bag, a stack, a queue, or some such. And this large chunk of work is
work that they won’t have to do. Instead, they will pull out the bag or stack or
queue that they wrote this semester—using it with no modifications. Or, more
likely, they will use the familiar data type from a library of standard data types,
such as the proposed Java Class Libraries. In fact, the behavior of some data
types in this text is a cut-down version of the JCL, so when students take the step
to the real JCL, they will be on familiar ground—from the standpoint of how to
use the class and also having a knowledge of the considerations that went into
building the class.

Other Foundational Topics


Throughout the course, we also lay a foundation for other aspects of “real pro-
gramming,” with coverage of the following topics beyond the basic data struc-
tures material.

Object-Oriented Programming. The foundations of object-oriented pro-


gramming are laid by giving students a strong understanding of Java classes.
The important aspects of classes are covered early: the notion of a method, the
separation into private and public members, the purpose of constructors, and a
small exposure to cloning and testing for equality. This is primarily covered in
Chapter 2, some of which can be skipped by students with a good exposure to
Java classes in the CS1 course.
Further aspects of classes are introduced when the classes first use dynamic
arrays (Chapter 3). At this point, the need for a more sophisticated clone method
is explained. Teaching this OOP method with the first use of dynamic memory
has the effect of giving the students a concrete picture of how an instance vari-
able is used as a reference to a dynamic object such as an array.
Conceptually, the largest innovation of OOP is the software reuse that occurs
via inheritance. There are certainly opportunities for introducing inheritance
right from the start of a data structures course (such as implementing a set class
as a descendant of a bag class). However, an early introduction may also result
in students juggling too many new concepts at once, resulting in a weaker under-
standing of the fundamental data structures. Therefore, in my own course, I intro-
duce inheritance at the end as a vision of things to come. But the introduction to
inheritance (Sections 13.1 and 13.2) could be covered as soon as classes are
understood. With this in mind, some instructors may wish to cover Chapter 13
earlier, just before stacks and queues, so that stacks and queues can be derived
from another class.
Preface ix

Another alternative is to identify students who already know the basics of


classes. These students can carry out an inheritance project (such as the ecosys-
tem of Section 13.3), while the rest of the students first learn about classes.

Java Objects. The Java Object type lies at the base of all the other Java
types—or at least almost all the other types. The eight primitive types are not
Java objects, and for many students, the CS1 work has been primarily with the
eight primitive types. Because of this, the first few data structures are collec-
tions of primitive values, such as a bag of integers or a sequence of double num-
bers.

Iterators. Iterators are an important part of the Java Class Libraries, allowing
a programmer to easily step through the elements in a collection class. The
Iteratable interface is introduced in Chapter 5. Throughout the rest of the
text, iterators are not directly used, although they provide a good opportunity for
programming projects, such as using a stack to implement an iterator for a
binary search tree (Chapter 9).

Recursion. First-semester courses often introduce students to recursion. But


many of the first-semester examples are tail recursion, where the final act of the
method is the recursive call. This may have given students a misleading impres-
sion that recursion is nothing more than a loop. Because of this, I prefer to avoid
early use of tail recursion in a second-semester course.
So, in our second-semester course, we emphasize recursive solutions that use
more than tail recursion. The recursion chapter provides four examples along
these lines. Two of the examples—generating random fractals and traversing a
maze—are big hits with the students. The fractal example runs as a graphical
applet, and although the maze example is text based, an adventurous student can
convert it to a graphical applet. These recursion examples (Chapter 8) appear just
before trees (Chapter 9) since it is within recursive tree algorithms that recursion
becomes vital. However, instructors who desire more emphasis on recursion can
move that topic forward, even before Chapter 2.
In a course that has time for advanced tree projects (Chapter 10), we analyze
the recursive tree algorithms, explaining the importance of keeping the trees
balanced—both to improve worst-case performance and to avoid potential
execution stack overflow.

Searching and Sorting. Chapters 11 and 12 provide fundamental coverage of


searching and sorting algorithms. The searching chapter reviews binary search
of an ordered array, which many students will have seen before. Hash tables are
also introduced in the search chapter by implementing a version of the JCL hash
table and also a second hash table that uses chaining instead of open addressing.
The sorting chapter reviews simple quadratic sorting methods, but the majority
of the chapter focuses on faster algorithms: the recursive merge sort (with
worst-case time of O(n log n)), Tony Hoare’s recursive quicksort (with average-
time O(n log n)), and the tree-based heapsort (with worst-case time of O(n log n)).
x Preface

Advanced Projects, Including Concurrency


The text offers good opportunities for optional projects that can be undertaken
by a more advanced class or by students with a stronger background in a large
class. Particular advanced projects include the following:
• Interactive applet-based test programs for any of the data structures (out-
lined in Appendix I).
• Implementing an iterator for the sequence class (see Chapter 5 Program-
ming Projects).
• Writing a deep clone method for a collection class (see Chapter 5 Pro-
gramming Projects).
• Writing an applet version of an application program (such as the maze tra-
versal in Section 8.2 or the ecosystem in Section 13.3).
• Using a stack to build an iterator for the binary search tree (see Chapter 9
Programming Projects).
• A priority queue implemented as an array of ordinary queues (Section
7.4) or implemented using a heap (Section 10.1).
• A set class implemented with B-trees (Section 10.2). I have made a partic-
ular effort on this project to provide sufficient information for students to
implement the class without need of another text. Advanced students have
successfully completed this project as independent work.
• Projects to support concurrent sorting in the final section of Chapter 12.
• An inheritance project, such as the ecosystem of Section 13.3.
• A graph class and associated graph algorithms in Chapter 14. This is
another case in which advanced students may do work on their own.

Java Language Versions


All the source code in the book has been tested to work correctly with Java 2
Standard Edition Version 7.0, including new features such as generics and new
concurrency support. Information on all of the Java products from Sun Micro-
systems is available at http://java.sun.com/products/index.html.
Flexibility of Topic Ordering
This book was written to give instructors latitude in reordering the material to
meet the specific background of students or to add early emphasis to selected
topics. The dependencies among the chapters are shown on the next page. A line
joining two boxes indicates that the upper box should be covered before the
lower box.
Here are some suggested orderings of the material:
Typical Course. Start with Chapters 1–9, skipping parts of Chapter 2 if the
students have a prior background in Java classes. Most chapters can be covered
in a week, but you may want more time for Chapter 4 (linked lists), Chapter 8
(recursion), or Chapter 9 (trees). Typically, I cover the material in 13 weeks,
Preface xi

Chapter Dependencies

At the start of the course, students should be comfortable writing


application programs and using arrays in Java.

Chapter 1
Introduction

Chapters 2–3
Classes
Reference variables
Collection classes Chapter 8
Recursion
Chapter 2 can be skipped by students
with a good background in Java classes.

Section 11.1
Chapter 4
Binary search
Linked lists
Chapter 13
Extended classes
Sections 5.1–5.4 Sec. 11.2–11.3
Generic programming Hash tables
(Also requires
Chapter 5)
Sections 5.5–5.7 Chapter 6
The Java API Stacks
Chapter 12
Iterators Sorting
Java collections (Heapsort also
Java maps Chapter 7 Chapter 9
needs Section
Queues Trees
10.1)

Section 10.1 Section 10.2 Section 10.3


Heaps B-trees Java trees

The shaded boxes provide


Section 10.4 Chapter 14
good opportunities for
Detailed tree analysis Graphs
advanced work.
xii Preface

including time for exams and extra time for linked lists and trees. Remaining
weeks can be spent on a tree project from Chapter 10 or on binary search (Sec-
tion 11.1) and sorting (Chapter 12).
Heavy OOP Emphasis. If students will cover sorting and searching else-
where, then there is time for a heavier emphasis on object-oriented program-
ming. The first three chapters are covered in detail, and then derived classes
(Section 13.1) are introduced. At this point, students can do an interesting OOP
project, perhaps based on the ecosystem of Section 13.3. The basic data struc-
tures (Chapters 4 –7) are then covered, with the queue implemented as a derived
class (Section 13.4). Finish up with recursion (Chapter 8) and trees (Chapter 9),
placing special emphasis on recursive methods.
Accelerated Course. Assign the first three chapters as independent reading in
the first week and start with Chapter 4 (linked lists). This will leave two to three
extra weeks at the end of the term so that students can spend more time on
searching, sorting, and the advanced topics (shaded in the chapter dependencies
list).
I also have taught the course with further acceleration by spending no lecture
time on stacks and queues (but assigning those chapters as reading).
Early Recursion / Early Sorting. One to three weeks may be spent at the
start of class on recursive thinking. The first reading will then be Chapters 1 and
8, perhaps supplemented by additional recursive projects.
If the recursion is covered early, you may also proceed to cover binary search
(Section 11.1) and most of the sorting algorithms (Chapter 12) before introduc-
ing collection classes.

Supplements Via the Internet


The following materials are available to all readers of this text at cssup-
port.pearsoncmg.com (or alternatively at www.cs.colorado.edu/~main/
dsoj.html):
• Source code
• Errata
In addition, the following supplements are available to qualified instructors.
Visit Addison-Wesley’s Instructor Resource Center (www.aw.com/irc) or con-
tact your local Addison-Wesley representative for access to these:
• PowerPoint® presentations
• Exam questions
• Solutions to selected programming projects
• Speaker notes
• Sample assignments
• Suggested syllabi
Preface xiii

Acknowledgments
This book grew from joint work with Walter Savitch, who continues to be an
ever-present and enthusiastic supporter, colleague, and friend. My students from
the University of Colorado at Boulder serve to provide inspiration and joy at
every turn, particularly the spring seminars in Natural Computing and Ideas in
Computing. During the past few years, the book has also been extensively
reviewed by J.D. Baker, Philip Barry, Arthur Crummer, Herbert Dershem, Greg
Dobbins, Zoran Duric, Dan Grecu, Scott Grissom, Bob Holloway, Rod Howell,
Danny Krizanc, Ran Libeskind-Hadas, Meiliu Lu, Catherine Matthews, Robert
Moll, Robert Pastel, Don Slater, Ryan Stansifer, Deborah Trytten, and John
Wegis. I thank these colleagues for their excellent critique and their encourage-
ment.
At Addison-Wesley, I thank Tracy Dunkelberger, Michael Hirsch, Bob
Engelhardt, and Stephanie Sellinger, who have provided continual support and
knowledgeable advice.
I also thank my friends and colleagues who have given me daily
encouragement and friendship during the writing of this fourth edition: Andrzej
Ehrenfeucht, Marga Powell, Grzegorz Rozenberg, and Allison Thompson-
Brown, and always my family: Janet, Tim, Hannah, Michelle, and Paul.

Michael Main (main@colorado.edu)


Boulder, Colorado
xiv Preface

Chapter List

Chapter 1 THE PHASES OF SOFTWARE DEVELOPMENT 1


Chapter 2 JAVA CLASSES AND INFORMATION HIDING 38
Chapter 3 COLLECTION CLASSES 103
Chapter 4 LINKED LISTS 175
Chapter 5 GENERIC PROGRAMMING 251
Chapter 6 STACKS 315
Chapter 7 QUEUES 360
Chapter 8 RECURSIVE THINKING 409
Chapter 9 TREES 453
Chapter 10 TREE PROJECTS 520
Chapter 11 SEARCHING 567
Chapter 12 SORTING 614
Chapter 13 SOFTWARE REUSE WITH EXTENDED CLASSES 675
Chapter 14 GRAPHS 728

APPENDIXES 775
INDEX 815
Contents xv

Contents
CHAPTER 1 THE PHASES OF SOFTWARE DEVELOPMENT 1
1.1 Specification, Design, Implementation 4
Design Technique: Decomposing the Problem 5
How to Write a Specification for a Java Method 6
Pitfall: Throw an Exception to Indicate a Failed Precondition 9
Temperature Conversion: Implementation 10
Programming Tip: Use Javadoc to Write Specifications 13
Programming Tip: Use Final Variables to Improve Clarity 13
Programming Tip: Make Exception Messages Informative 14
Programming Tip: Format Output with System.out.printf 14
Self-Test Exercises for Section 1.1 15
1.2 Running Time Analysis 16
The Stair-Counting Problem 16
Big-O Notation 21
Time Analysis of Java Methods 23
Worst-Case, Average-Case, and Best-Case Analyses 25
Self-Test Exercises for Section 1.2 26
1.3 Testing and Debugging 26
Choosing Test Data 27
Boundary Values 27
Fully Exercising Code 28
Pitfall: Avoid Impulsive Changes 29
Using a Debugger 29
Assert Statements 29
Turning Assert Statements On and Off 30
Programming Tip: Use a Separate Method for Complex Assertions 32
Pitfall: Avoid Using Assertions to Check Preconditions 34
Static Checking Tools 34
Self-Test Exercises for Section 1.3 34
Chapter Summary 35
Solutions to Self-Test Exercises 36

CHAPTER 2 JAVA CLASSES AND INFORMATION HIDING 38


2.1 Classes and Their Members 40
Defining a New Class 41
Instance Variables 41
Constructors 42
No-Arguments Constructors 43
Methods 43
Accessor Methods 44
Programming Tip: Four Reasons to Implement Accessor Methods 44
Pitfall: Division Throws Away the Fractional Part 45
Programming Tip: Use the Boolean Type for True or False Values 46
Modification Methods 46
Pitfall: Potential Arithmetic Overflows 48
Complete Definition of Throttle.java 48
Methods May Activate Other Methods 51
Self-Test Exercises for Section 2.1 51
xvi Contents

2.2 Using a Class 52


Creating and Using Objects 52
A Program with Several Throttle Objects 53
Null References 54
NullPointerException 55
Assignment Statements with Reference Variables 55
Clones 58
Testing for Equality 58
Terminology Controversy: “The Throttle That t Refers To” 59
Self-Test Exercises for Section 2.2 59
2.3 Packages 60
Declaring a Package 60
The Import Statement to Use a Package 63
The JCL Packages 63
More about Public, Private, and Package Access 63
Self-Test Exercises for Section 2.3 65
2.4 Parameters, Equals Methods, and Clones 65
The Location Class 66
Static Methods 72
Parameters That Are Objects 73
Methods May Access Private Instance Variables of Objects in Their Own Class 74
The Return Value of a Method May Be an Object 75
Programming Tip: How to Choose the Names of Methods 76
Java’s Object Type 77
Using and Implementing an Equals Method 77
Pitfall: ClassCastException 80
Every Class Has an Equals Method 80
Using and Implementing a Clone Method 81
Pitfall: Older Java Code Requires a Typecast for Clones 81
Programming Tip: Always Use super.clone for Your Clone Method 85
Programming Tip: When to Throw a Runtime Exception 85
A Demonstration Program for the Location Class 85
What Happens When a Parameter Is Changed Within a Method? 86
Self-Test Exercises for Section 2.4 89
2.5 The Java Class Libraries 90
Chapter Summary 92
Solutions to Self-Test Exercises 93
Programming Projects 95
Contents xvii

CHAPTER 3 COLLECTION CLASSES 103


3.1 A Review of Java Arrays 104
Pitfall: Exceptions That Arise from Arrays 106
The Length of an Array 106
Assignment Statements with Arrays 106
Clones of Arrays 107
The Arrays Utility Class 108
Array Parameters 110
Programming Tip: Enhanced For-Loops for Arrays 111
Self-Test Exercises for Section 3.1 112
3.2 An ADT for a Bag of Integers 113
The Bag ADT—Specification 114
OutOfMemoryError and Other Limitations for Collection Classes 118
The IntArrayBag Class—Specification 118
The IntArrayBag Class—Demonstration Program 122
The IntArrayBag Class—Design 125
The Invariant of an ADT 126
The IntArrayBag ADT—Implementation 127
Programming Tip: Cloning a Class That Contains an Array 136
The Bag ADT—Putting the Pieces Together 137
Programming Tip: Document the ADT Invariant in the Implementation File 141
The Bag ADT—Testing 141
Pitfall: An Object Can Be an Argument to Its Own Method 142
The Bag ADT—Analysis 142
Self-Test Exercises for Section 3.2 144
3.3 Programming Project: The Sequence ADT 145
The Sequence ADT—Specification 146
The Sequence ADT—Documentation 150
The Sequence ADT—Design 150
The Sequence ADT—Pseudocode for the Implementation 156
Self-Test Exercises for Section 3.3 158
3.4 Programming Project: The Polynomial 159
Self-Test Exercises for Section 3.4 162
3.5 The Java HashSet and Iterators 162
The HashSet Class 162
Some of the HashSet Members 162
Iterators 163
Pitfall: Do Not Access an Iterator’s next Item When hasNext Is False 164
Pitfall: Changing a Container Object Can Invalidate Its Iterator 164
Invalid Iterators 164
Self-Test Exercises for Section 3.5 165
Chapter Summary 165
Solutions to Self-Test Exercises 166
Programming Projects 169
xviii Contents

CHAPTER 4 LINKED LISTS 175


4.1 Fundamentals of Linked Lists 176
Declaring a Class for Nodes 177
Head Nodes, Tail Nodes 177
The Null Reference 178
Pitfall: NullPointerExceptions with Linked Lists 179
Self-Test Exercises for Section 4.1 179
4.2 Methods for Manipulating Nodes 179
Constructor for the Node Class 180
Getting and Setting the Data and Link of a Node 180
Public Versus Private Instance Variables 181
Adding a New Node at the Head of a Linked List 182
Removing a Node from the Head of a Linked List 183
Adding a New Node That Is Not at the Head 185
Removing a Node That Is Not at the Head 188
Pitfall: NullPointerExceptions with removeNodeAfter 191
Self-Test Exercises for Section 4.2 191
4.3 Manipulating an Entire Linked List 192
Computing the Length of a Linked List 193
Programming Tip: How to Traverse a Linked List 196
Pitfall: Forgetting to Test the Empty List 197
Searching for an Element in a Linked List 197
Finding a Node by Its Position in a Linked List 198
Copying a Linked List 200
A Second Copy Method, Returning Both Head and Tail References 204
Programming Tip: A Method Can Return an Array 205
Copying Part of a Linked List 206
Using Linked Lists 207
Self-Test Exercises for Section 4.3 214
4.4 The Bag ADT with a Linked List 215
Our Second Bag—Specification 215
The grab Method 219
Our Second Bag—Class Declaration 219
The Second Bag—Implementation 220
Programming Tip: Cloning a Class That Contains a Linked List 223
Programming Tip: How to Choose between Different Approaches 225
The Second Bag—Putting the Pieces Together 229
Self-Test Exercises for Section 4.4 232
4.5 Programming Project: The Sequence ADT with a Linked List 232
The Revised Sequence ADT—Design Suggestions 232
The Revised Sequence ADT—Clone Method 235
Self-Test Exercises for Section 4.5 238
4.6 Beyond Simple Linked Lists 239
Arrays Versus Linked Lists and Doubly Linked Lists 239
Dummy Nodes 240
Java’s List Classes 241
ListIterators 242
Making the Decision 243
Self-Test Exercises for Section 4.6 244
Chapter Summary 244
Solutions to Self-Test Exercises 245
Programming Projects 248
Contents xix

CHAPTER 5 GENERIC PROGRAMMING 251


5.1 Java’s Object Type and Wrapper Classes 252
Widening Conversions 253
Narrowing Conversions 254
Wrapper Classes 256
Autoboxing and Auto-Unboxing Conversions 256
Advantages and Disadvantages of Wrapper Objects 257
Self-Test Exercises for Section 5.1 257
5.2 Object Methods and Generic Methods 258
Object Methods 259
Generic Methods 259
Pitfall: Generic Method Restrictions 260
Self-Test Exercises for Section 5.2 261
5.3 Generic Classes 262
Writing a Generic Class 262
Using a Generic Class 262
Pitfall: Generic Class Restrictions 263
Details for Implementing a Generic Class 263
Creating an Array to Hold Elements of the Unknown Type 263
Retrieving E Objects from the Array 264
Warnings in Generic Code 264
Programming Tip: Suppressing Unchecked Warnings 265
Using ArrayBag as the Type of a Parameter or Return Value 266
Counting the Occurrences of an Object 266
The Collection Is Really a Collection of References to Objects 267
Set Unused References to Null 269
Steps for Converting a Collection Class to a Generic Class 269
Deep Clones for Collection Classes 271
Using the Bag of Objects 279
Details of the Story-Writing Program 282
Self-Test Exercises for Section 5.3 282
5.4 Generic Nodes 283
Nodes That Contain Object Data 283
Pitfall: Misuse of the equals Method 283
Other Collections That Use Linked Lists 285
Self-Test Exercises for Section 5.4 285
5.5 Interfaces and Iterators 286
Interfaces 286
How to Write a Class That Implements an Interface 287
Generic Interfaces and the Iterable Interface 287
How to Write a Generic Class That Implements a Generic Interface 288
The Lister Class 289
Pitfall: Don’t Change a List While an Iterator Is Being Used 291
The Comparable Generic Interface 292
Parameters That Use Interfaces 293
Using instanceof to Test Whether a Class Implements an Interface 294
The Cloneable Interface 295
Self-Test Exercises for Section 5.5 295
xx Contents

5.6 A Generic Bag Class That Implements the Iterable Interface (Optional Section) 296
Programming Tip: Enhanced For-Loops for the Iterable Interface 297
Implementing a Bag of Objects Using a Linked List and an Iterator 298
Programming Tip: External Iterators Versus Internal Iterators 298
Summary of the Four Bag Implementations 299
Self-Test Exercises for Section 5.6 299
5.7 The Java Collection Interface and Map Interface (Optional Section) 300
The Collection Interface 300
The Map Interface and the TreeMap Class 300
The TreeMap Class 302
The Word Counting Program 305
Self-Test Exercises for Section 5.7 306
Chapter Summary 309
Solutions to Self-Test Exercises 310
Programming Projects 312

CHAPTER 6 STACKS 315


6.1 Introduction to Stacks 316
The Stack Class—Specification 317
We Will Implement a Generic Stack 319
Programming Example: Reversing a Word 319
Self-Test Exercises for Section 6.1 320
6.2 Stack Applications 320
Programming Example: Balanced Parentheses 320
Programming Tip: The Switch Statement 324
Evaluating Arithmetic Expressions 325
Evaluating Arithmetic Expressions—Specification 325
Evaluating Arithmetic Expressions—Design 325
Implementation of the Evaluate Method 329
Evaluating Arithmetic Expressions—Testing and Analysis 333
Evaluating Arithmetic Expressions—Enhancements 334
Self-Test Exercises for Section 6.2 334
6.3 Implementations of the Stack ADT 335
Array Implementation of a Stack 335
Linked List Implementation of a Stack 341
Self-Test Exercises for Section 6.3 344
6.4 More Complex Stack Applications 345
Evaluating Postfix Expressions 345
Translating Infix to Postfix Notation 348
Using Precedence Rules in the Infix Expression 350
Correctness of the Conversion from Infix to Postfix 353
Self-Test Exercises for Section 6.4 354
Chapter Summary 354
Solutions to Self-Test Exercises 355
Programming Projects 356
Contents xxi

CHAPTER 7 QUEUES 360


7.1 Introduction to Queues 361
The Queue Class 362
Uses for Queues 364
Self-Test Exercises for Section 7.1 365
7.2 Queue Applications 365
Java Queues 365
Programming Example: Palindromes 366
Programming Example: Car Wash Simulation 369
Car Wash Simulation—Specification 369
Car Wash Simulation—Design 369
Car Wash Simulation—Implementing the Car Wash Classes 374
Car Wash Simulation—Implementing the Simulation Method 375
Self-Test Exercises for Section 7.2 375
7.3 Implementations of the Queue Class 383
Array Implementation of a Queue 383
Programming Tip: Use Helper Methods to Improve Clarity 386
Linked List Implementation of a Queue 393
Pitfall: Forgetting Which End Is Which 398
Self-Test Exercises for Section 7.3 398
7.4 Deques and Priority Queues (Optional Section) 399
Double-Ended Queues 399
Priority Queues 400
Priority Queue ADT—Specification 400
Priority Queue Class—An Implementation That Uses an Ordinary Queue 402
Priority Queue ADT—A Direct Implementation 403
Java’s Priority Queue 403
Self-Test Exercises for Section 7.4 404
Chapter Summary 404
Solutions to Self-Test Exercises 404
Programming Projects 406

CHAPTER 8 RECURSIVE THINKING 409


8.1 Recursive Methods 410
Tracing Recursive Calls 413
Programming Example: An Extension of writeVertical 413
A Closer Look at Recursion 415
General Form of a Successful Recursive Method 418
Self-Test Exercises for Section 8.1 419
8.2 Studies of Recursion: Fractals and Mazes 420
Programming Example: Generating Random Fractals 420
A Method for Generating Random Fractals—Specification 421
The Stopping Case for Generating a Random Fractal 426
Putting the Random Fractal Method in an Applet 426
Programming Example: Traversing a Maze 429
Traversing a Maze—Specification 429
Traversing a Maze—Design 432
Traversing a Maze—Implementation 433
The Recursive Pattern of Exhaustive Search with Backtracking 435
Programming Example: The Teddy Bear Game 437
Self-Test Exercises for Section 8.2 437
Another Random Scribd Document
with Unrelated Content
The Project Gutenberg eBook of Graham's
Magazine, Vol. XXXI, No. 2, August 1847
This ebook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this ebook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.

Title: Graham's Magazine, Vol. XXXI, No. 2, August 1847

Author: Various

Editor: George R. Graham

Release date: February 11, 2019 [eBook #58864]

Language: English

Credits: Produced by Mardi Desjardins & the online Distributed


Proofreaders Canada team at
https://www.pgdpcanada.net
from page images generously made available by
Google Books

*** START OF THE PROJECT GUTENBERG EBOOK GRAHAM'S


MAGAZINE, VOL. XXXI, NO. 2, AUGUST 1847 ***
GRAHAM’S MAGAZINE.
Vol. XXXI. August, 1847. No. 2.

Table of Contents

Fiction, Literature and Articles


The Slaver (continued)
Cora Neill
A New Way to Collect an Old Debt
The Islets of the Gulf (continued)
Evelyn Grahame. A Tale of Truth
Reality Versus Romance, or The Young Wife
Review of New Books

Poetry and Fashion


Le Follet
Linolee
The Dreamer
The Demon of the Mirror
The Lifted Veil
Thou Art Cold
The Spanish Lovers

Transcriber’s Notes can be found at the end of this eBook.


Anaïs Toudouze
LE FOLLET
Boulevart St. Martin, 61
Chapeaux de Mme. Penet, r. Nve. St. Augustin, No. 4,
Plumes et fleurs de Chagot—Robes de Mme. Leymerie—Mantilles de
Violard, r. Choiseul, 2bis.
Mouchoirs de L. Chapron & Dubois, r. de la Paix, 7—Ombrelle de
Lemaréchal, bt. Montmartre, 17.
Graham’s Magazine.

GRAHAM’S MAGAZINE.

Vol. XXXI. PHILADELPHIA, August, 1847.


No. 2.

THE SLAVER.
A TALE OF OUR OWN TIMES.

———
BY A SON OF THE LATE DR. JOHN D. GODMAN.
———

(Continued from page 12.)


CHAPTER V.
All lost! To prayers, to prayers!
All lost!
. . . . . . . . .

He’ll be hanged yet;


Though every drop of water swear against it,
And gape at wid’st to glut him.
Tempest.

The next morning, at the appointed time, accompanied by a


young Spaniard, as second, Willis was on the beach, where he found
De Vere and his friend. The foes saluted each other with the most
scrupulous politeness. Ten paces were measured as the distance,
and they took their positions.
The signal was given, and both fired, but with unequal success;
at the report De Vere sprung up, and then fell senseless at full
length upon the sand; Willis was unharmed, and merely asking his
opponent’s second if his friend wished another shot—to which, of
course, he replied in the negative—he got into his boat, and without
even looking at De Vere, pulled back to the harbor.
Anxious to get away from Havana as soon as possible, for, since
his rencounter with De Vere, he was confident that Francisca must
know his true character, or rather the character De Vere had falsely
given him, and not desiring to meet her or her father, Willis made all
possible dispatch to get through with his business; and in two days
after the duel he was again at sea, and bound for Africa.
The cargo he would bring with him was engaged to a trader on
the other side of the island, and he did not intend returning to
Havana.
He had a quick and fortunate run over, and was four days out, on
his return, with the best lot of negroes he had ever obtained, all
grown men, strong and healthy, when he fell in with a sail.
He discovered it to be a large ship, to leeward of him some six or
eight miles; he knew her to be a man-of-war, by the squareness of
her yards, and who, as soon as she saw the Maraposa, took another
pull at the lee-braces, and put her helm a little more a-lee; but she
might as well have tried to sail in the teeth of a tornado as out-
weather the schooner, though the accuracy with which she
maintained her distance and position proved her to be a remarkably
fast sailer. Willis had no fear of the ship overtaking him, and held on
his course; day after day, for nearly a week, the two vessels were in
the same relative position, almost on parallel lines, but between six
and eight miles apart; both under all the sail they could carry. On
the eighth day it fell dead calm, and both the ship and schooner lay
motionless on the smooth water.
The scorching beams of an equatorial sun rendered the heat
insufferable, even on deck; but in the hold of the slaver the heat and
the stench were absolutely awful! and the poor negroes, nearly
frantic, were continually shrieking for water and air.
Their cries brought them small relief. The attention of Willis and
the crew was too much occupied by other matters, to pay any more
attention to the blacks than see they were secure; for as soon as the
wind died away, the ship had commenced getting out her boats.
Already had Willis seen three of them lowered over, and he felt
confident the captain of the sloop-of-war intended attacking him
with the whole strength of his crew.
One! two! three! more boats he counted, as they swung an
instant in the air, and then dropped in the water. Aided by his glass,
he saw the men hurrying down the ship’s side to man them.
But he knew it was a work of time and labor to row eight miles in
the intense heat, and it was not until he had seen the launch, four
cutters, and even the gig, six boats in all, pull round the sloop’s
bows, crowded with men, and forming a line, stretch out toward the
Maraposa, that he commenced preparations to repel the attack.
The force approaching was formidable, nearly an hundred men,
and the crew of the slaver, counting all hands, even Willis and the
cook, was barely half the number.
The schooner, acting only on the defensive, and being so much
higher out of the water than the boats, made this disparity in
numbers less to be dreaded; and the confidence Willis had in his
men, and they in him, made the slavers feel secure in the result of
the approaching struggle; and it was with a loud and hearty shout
that his crew answered, when Willis called —
“All hands to quarters!”
“Open the magazine! Trice up the boarding-nettings! and stand
by, to give those English fools h—l! for meddling with what don’t
concern them.”
These orders were soon obeyed, and the schooner with her six
caronnades looking through the port-holes, double boarding-nettings
triced up, and her desperate crew armed to the teeth, with calm,
determined resolution printed on their countenances, quietly
watching the coming foe, was the personification of men “grown old
in desperate hardihood;” fortified with the determination of resisting
to the death.
The line of black boats, with their long oars regularly rising and
falling, resembled huge beetles, as they came across the glass-like
sea; and in an hour and a half they were within a mile of the
schooner. Shot after shot was fired at them from the long gun of the
Maraposa, but unharmed they steadily approached to within the
distance of a hundred yards, when, with a loud huzza, they formed
abreast, the launch a little in advance, and made a dash at the
schooner, with the intention of all boarding at once.
Then was heard the thunder of the three larboard caronnades, as
they hurled forth their iron hail, and a yell of agony, and the sudden
swamping of the launch and fourth cutter attested the deadly effect
of the fire; but the other boats undaunted, before the guns could be
again loaded, had reached the vessel, and, with shouts and hoarse
huzzas, were trying to board her.
But the attempt was futile! with boarding-pike, cutlas point, and
pistol shot, her hardy crew repulsed them. Again! and again! with
the determined and dogged courage of English tars, they
endeavored to get on deck, but the men of the slaver, cheered on by
Willis, drove them back each time with loss, and the lieutenant in
command of the expedition, fearing all his men would be lost, drew
off. Another broadside from the schooner sunk one more of the
boats, and pulling as quickly as possible out of the range of the
slavers’ guns, with slow and feeble strokes, crest fallen, and
deprived of half their boats and men, the attacking party proceeded
toward their ship.
Ere they had accomplished a third of the distance, the ship was
seen to square away her yards, and commenced moving through the
water to meet them; the wind had sprung up again, but coming out
from the south’ard, it brought the ship to windward, instead of to
leeward, as she had been before the calm, and feeling its effects
first, she was gathering way before the schooner felt it; soon
however it reached the slaver, and with her sheets eased off, the
Maraposa commenced merrily to continue her course.
Willis had only four men killed in the late action, and with his
feelings elated at the severe repulse he had given the men-of-wars-
men, whom he cordially hated for their incessant persecution of the
slavers, and whose boasted philanthropy, the motive which they
pretend actuates them, he was aware was only practiced for the
effect it had upon the world, and not for any benefit the Africans
derived; for he knew that the condition of the recaptured negroes,
as English apprentices, was infinitely worse than as Spanish slaves;
for in the one case they had all the horrors of slavery without the
name or benefits, in the other the name without the horrors.
He was congratulating himself on his good fortune, and the
prospect of making a safe and profitable voyage, when the current
of his thoughts were changed by the appearance of a sail on his
weather bow. The sloop lost time by heaving-to, to get in her boats,
and was about ten miles astern; and the strange sail was some six
miles ahead, standing to the northward and eastward, a course that
would bring her exactly across the schooner’s track.
“Take the glass, Mateo,” said Willis, “and jump up on the fore-
topsail yard, and see if you can make out that chap ahead; he may
be only some merchantman after all.”
Mateo took the glass, and rapidly going aloft, sung out in a voice
of surprise—“Soul of my mother! if it is not our old friend the
Scorpion! who must have a new captain, for you left the other past
service!”
Willis was at a loss how to act. If he kept on he would meet the
Scorpion, and the sloop behind would soon be up, and then he
would have them both on him, and the brig alone was more than a
match for the Maraposa; eat them out of the wind he could not, for
they were both to windward of him; to bear away dead before it was
only the same thing as keeping on, for both vessels, spreading a
great deal more canvas, would have outsailed him, going with the
wind over the tafferel.
“Well, Mateo, what do you think of the prospect?” asked Willis of
his mate, as he joined him on deck.
“Pretty squally, sir! we can’t run either way!”
“No! but we can keep on and fight!”
“Yes, sir! but if the brig wings us, and we can hardly expect to
get off again with sound spars, we will only fall into the clutches of
the sloop, even if we whip the brig.”
“Well,” said the captain, “we can’t do any better, and must make
our wits help us. To begin with, set the Portuguese flag, and let each
man arm himself with four pistols and a cutlas, and be ready to obey
orders.”
The vessels were rapidly approaching one another, and the brig,
getting within reach, fired. The ball struck in the water so close to
the schooner as to cast the spray on her deck; but another shot
coming through the bulwarks, and lodging in the heel of the
bowsprit, Willis lowered his ensign, in token of submission; and
putting his helm up, lay-to, by bringing the schooner in the wind.
When the ensign was lowered, the brig ceased firing; and getting
within hailing distance, an officer on her forecastle, ordered the
Maraposa to round-to under her lee-quarter.
“Ay, ay,” answered Willis, as he heard the order given on board
the brig to back the main-topsail. Shoving his helm shear a-port, he
brought the schooner directly athwart the brig’s weather bow. As
soon as he heard the vessels grate, as they came in contact, he
sung out, “Away, ye butterflies! away!” and springing up his own
fore-rigging, leaped, cutlas in hand, down on the deck of the brig,
followed by his whole crew, with the exception of two or three, who
remained behind to take charge of the schooner.
The brig’s crew had not time to rally from the surprise of this
unexpected and desperate onslaught; for the slavers rushed upon
them with the ferocity and vindictiveness of bloodhounds.
Discharging their pistols as they jumped on board, they threw them
at the heads of their foes, with wild yells, and then, with boarding-
axe and cutlas, they joined in the deadly encounter.
Surprised by the suddenness of Willis’s attack, and unprepared
for it, the Englishmen gave back before the impetuosity of his first
burst, and he was soon in possession of the forecastle; but, rallying
in the gangways, the slaughter on both sides was immense—hand to
hand, toe to toe, they fought; and as a man on either side fell,
another stepped into his place.
The shouts and huzzas that resounded from both parties, at the
commencement of the affray, had now died away, and the only
sounds heard were the clink of steel, as their weapons came in
contact, or the sullen, dead sound of a boarding-axe, as it crushed
through a skull, and an occasional groan, uttered by some poor
fellow in his death-agony. The termination of the conflict was
doubtful, when the state of affairs was altered, by an event equally
startling to both sides.
The negroes confined in the hold of the Maraposa, frantic from
their confinement and suffering, and finding the crew had left her,
succeeded in breaking their bonds, and rushed on deck, wild with
delight at being loose, and burning for revenge, they threw
overboard the few men left in charge of the schooner, and hearing
the conflict on the brig, some sixty of them, armed with handspikes,
iron belaying-pins, monkey-tails,[1] and whatever they could pick up,
came tumbling on board, and falling upon the rear of the slavers,
with unearthly and savage noises, they threw them into great
disorder, and created a diversion in favor of the man-of-war’s men,
which they were not slow in taking advantage of, and with a loud
hurrah, they charged over the Maraposas, and thought the day was
already theirs; but the negroes, who had only attacked the slavers
because they met them first as they came over the bow, knew no
difference in the white men; and as the brig’s crew came within their
reach, were assaulted as fiercely as the slavers; and not until every
African had been slain, or forced overboard, was the brig once more
in the possession of her own crew.
The Maraposa, after the men in charge of her were thrown
overboard, had forged clear of the brig, and was now drifting about,
sometimes with her sails full, and then all aback, some quarter of a
mile off—the negroes dancing, jumping, and fighting on her deck
like a drove of monkeys.
Willis, who, looking around when the slaves first fell upon his
men to see what was the matter, had received a severe blow on the
back of his head from a cutlas. His hat turning the edge, he was only
stunned by the force of the blow, and gradually recovering his
senses, he raised himself on his elbow. At first his mind wandered,
and he did not recollect where he was; but soon the familiar faces of
many of his own men, and the bodies of the English sailors who lay
around him, covered with ghastly wounds, and stiff in the cold
embrace of death; the groans of the wounded, as they were borne
past him, on their way to the cockpit, recalled vividly to his
imagination his melancholy situation.
Rising to his feet, and looking around, he found that, for the
present at least, his position was nearly hopeless. Scarce half a
dozen of his men had escaped with life, his vessel out of his reach,
and he a prisoner to those from whom he did not expect civil
treatment; then with the certainty, nearly, of the dangling noose,
and foreyard-arm in the future.
A few months previous it would have caused the slaver’s captain
not a moment’s uneasiness, had he been in even a greater strait. If
the gallows-rope had been quivering over his head, its noose gaping
to receive his neck, it would not then have caused a difference in his
pulse, or a pang of sorrow in his heart—for he was then both brave
and reckless; and knowing when he entered his present life that the
penalty was death, he would but have thought the deal had been
against him, the game lost, and he, of course, must pay the stake.
For what is life worth without an aim—an object; living but to eat,
drink, and toil. With nothing to look forward to in the future but a
cessation from monotony, is worse than death. And Willis, driven
from the field of honorable ambition, at enmity with his relations,
and loving or beloved by no one, had little to fear from death or
disgrace.
But now, his feelings were altered. Love, that all powerful
passion, had brought about a change; not that he now feared death,
but the manner of it; and the thought that the last Francisca would
hear of him, as the condemned felon, who had paid the penalty of
the law without even repenting of his course, was harrowing. And he
had thought, too, that time, which brings about the most apparently
improbable things, might so arrange events, that he would not
always be the outcast he now was; and even in the dim future he
had pictured to himself Francisca as being his.
It seemed, however, as if his course would now soon be run, and
his hopes blighted; and, steeped in intense agony of mind, he was
insensible to aught around, when he was aroused by a rough grasp
on the shoulder, and a sailor asked if he was not the captain of the
schooner.
He answered in the affirmative, and was told the captain of the
brig wished to see him. Following the sailor, he was led to the cabin.
Coming from the light of the sun, it was comparatively dark, and at
first Willis did not observe that any one was in it; but becoming
accustomed to the light, he discovered the figure of De Vere, pale
and attenuated, lying on a sofa.
At first Willis was somewhat shocked; for he thought that De
Vere had been killed in the duel, which belief was confirmed by not
seeing him on deck during the fight; but knowing, now, that he had
been only wounded, he quickly regained his look of quiet
composure, and fixing his eye on De Vere’s, he stood silently before
him.
A smile of gratified hatred was playing over De Vere’s white face;
and the sight of Willis, knowing him to be completely in his power,
seemed to afford him so much pleasure, that, gloating on him with a
sparkling eye, he did not break the silence for some moments.
“You thought I was dead, did you, my noble captain?” he at last
said, in a satyrical tone; “but you find I have life enough left yet to
be at your hanging; and I have a mind, for fear I should not, to have
you strung up now. Twice you have had the luck—the third time is
mine.”
Willis deigned not an answer; and with a curled lip, expressive of
his scorn, remained motionless.
For a short time the captain of the brig looked at him in silence,
and then, apparently overcome by bodily fatigue, ordered Willis to
be put in double irons, which being put upon him at once, he was
carried on the berth-deck, and placed under the charge of a
sentinel.
As soon as the wounded had been carried below, the brig sent a
prize crew on board the captured slaver; and after a short struggle,
they succeeded in reducing her negroes to submission.
By this time the ship that had been chasing the schooner, and
whose boats had been repulsed in the morning, came up, and
proved to be the Vixen, whose captain coming on board of the
Scorpion, in consequence of Capt. De Vere’s inability to leave his
cabin, and congratulated him on his good fortune in capturing the
Maraposa, ordered him to proceed to Havana with the prize, and
have her condemned, and her crew, or what remained of them, tried
by the mixed commission;[2] and leaving them to make the passage,
we will return to where we left De Vere, on the beach, after his duel
with Willis.

[1] Monkey-tails. Short, iron crow-bars, used as levers


in moving the breech of the guns.
[2] A court established in Havana, expressly for the trial
of slavers.

——
CHAPTER VI.
Jul. What villain, madam?
Lady Cap. That same villain, Romeo.
Jul. Villain and he are many miles asunder
God pardon him! I do, with all my heart:
And yet no man, like he, doth grieve my heart.
Romeo and Juliet.

When De Vere’s second picked him up, he was senseless; and his
shirt, stained with blood on the left breast, made him think he had
been shot through the heart. But the surgeon of the brig, who was
in attendance, examined him more closely, and found that he had
made a narrow escape; he was not mortally, but still dangerously
wounded; the ball had struck directly over the heart, but taking a
diagonal direction, it had passed out under his arm, without touching
the seat of life.
Carefully raising him, they carried him to the boat, and
supporting him on their knees, he was conveyed to his vessel, then
at anchor in the harbor.
De Vere had promised to dine at Don Manuel’s the day of the
duel; and the old gentleman, surprised at his absence—for he had
always been most punctual in keeping his appointments there—sent
a servant down to the brig to see if the captain was unwell.
The man came hurrying back with a long, exaggerated report of
the affair, and said that “Captain De Vere had been shot by a
notorious slave captain; and was dying, if not already dead.”
Alarmed at this information, the old gentleman went at once to
see De Vere; and finding he was only badly wounded, by the
consent of the physician, had him removed from the brig to his own
house.
So occupied was Don Velasquez with attending on the sick
captain, that for a day or two he neglected to call on “Brewster,”
though he was constantly endeavoring to think of some method by
which he could express the gratitude he felt for the preservation of
his beloved daughter; and he wondered why “Brewster” had not
again been to the house.
On the third day, however, his sense of duty not permitting him
longer to neglect one to whom he was under such great obligations,
he went out to see the captain of the schooner, and was surprised to
find the vessel had left the port.
Feeling vexed and mortified with himself that he had not more
promptly called upon “Brewster;” and believing his unceremonious
departure was occasioned by his own lack of proper attentions, he
returned home, and told his daughters of the disappointment he had
met.
Clara, whose pride was hurt, that one to whom the family were
indebted had been permitted thus to depart, with the obligation
unrequited, freely expressed her sorrow. Francisca said very little,
nothing more than was absolutely necessary, but felt far, far more
than either of them.
Pleased by the favorable impression Willis had made upon Clara,
and knowing that her father would naturally feel kindly toward one
who had rendered her such valuable service, she had been
permitting herself to indulge in pleasant visions of the future, in
which she saw every thing “couleur de rose,” and a happy
consummation to her heart’s passion.
These bright day-dreams were now all dispelled; and with a sad
heart she retired to the privacy of her chamber, to mourn over her
hard lot; for she thought “if Brewster had cared any thing for me, he
would at least have said, adieu, before leaving, perhaps for ever.”
De Vere, knowing the obligations Don Velasquez was under to
Willis, had, from a gentlemanly feeling, refrained from telling him
that Captain “Brewster, of the Portuguese navy,” was no other than
Willis, the notorious slaver, and the person who had so nearly killed
him; but when the old gentleman told him of “Brewster’s” sudden
departure, he apparently suffered so much from mortification and
self reproach, that De Vere thought it would relieve his mind to know
the true character of the person in whom he took so much interest;
he therefore told him, giving Willis, not his true character, but the
false one public report had fastened upon him.
Don Manuel listened to this narrative with varying emotions. At
first he could not credit it, so much was Willis’s appearance,
manners, and air distingué, at variance with his calling; but De Vere
insisted upon the correctness of his statement, and then the Don
was sorry, that one fitted to move in so much more elevated a
sphere, had no higher ambition or aim.
Upon the whole, however, Don Velasquez’s wounded self-esteem
was soothed; for though the obligation was in reality the same as
before, believing, now, that Willis’s mind must necessarily be sordid
and base, he thought money would liquidate the debt, and he would
still have an opportunity of acknowledging it. In the other case, with
a high-minded and gentlemanly man, as he had supposed him to be,
courtesies and attentions were the only return he could have made;
and to do this he had lost the opportunity.
Soothing his feelings, therefore, by resolving handsomely to
reward Willis, if ever he had the opportunity, he determined to give
himself no further trouble about the matter.
Clara, when she learned that “Brewster” had shot De Vere, and
was a negro trader, was loud in her reproaches; and calling him
many hard names, wondered how he had the impudence to enter
the house of a gentleman, and congratulated her sister upon her
lucky escape, after being in the power of such a wretch.
Poor Francisca, when she first heard the intelligence, felt as if her
heart had been shocked by an earthquake; for it seemed as if an
insurmountable barrier had now been raised between her and Willis.
True to her woman’s heart, she still loved him as much as ever,
and would not believe the reports to his detriment. She thought of
him but as she had known and seen him—kind, gentle, and noble;
and that if he was a slaver, it was not his own choice, but the result
of some dire necessity; and each time she heard De Vere or her
sister berate him, though it deeply wounded her, it only made the
remembrance of him more dear; for she felt the slanders were false.
Silently, however, she bore her sorrows; for, fearing to increase her
sister’s animosity, she never took the part of Willis when his name
was slurred.
The old duenna was the only one that stood out openly for the
defamed Willis; she stoutly declared “that Brewster, or Willis, slaver,
or man-of-war, she did not care which, he was the handsomest, the
most gentlemanly, and the kindest man she had ever seen; and if
ever she was in danger, she hoped he might be near to protect her;
and that it was a shame for them thus to run him down behind his
back, when he saved Señorita Francisca’s life, to say nothing of her
own.”
Balm it was to Francisca, to hear the old lady thus give utterance
to the thoughts she did not dare to speak; and in her daily orisons,
regularly did she supplicate the Virgin to protect the slaver’s captain,
and keep him in safety.
Captain De Vere’s wound, by assiduous nursing, did not prove
fatal; but his anxiety to be revenged on Willis was so great, that
before he was able to leave his couch, and against the advice and
entreaties of Don Manuel, Clara, and the physician, he insisted upon
joining his vessel, and going to sea, with the hope of capturing the
Maraposa on her return passage.
The result of his cruise has already been given in the preceding
chapter.

——
CHAPTER VII
Be not afraid!
’Tis but a pang, and then a thrill,
A fever fit, and then a chill,
And then an end of human ill;
For thou art dead.
Scott’s Lay of Louise.

The Scorpion and her prize had arrived safely in Havana. Willis,
heavily manacled, was brought on deck, where, joined by the small
remnant of his crew, amongst whom he was glad to discover the
face of Mateo, though its symmetry had been spoiled by a cutlas-
cut, extending from under his right eye to the left corner of his
mouth, entirely severing the end of his nose. The captain of the
Maraposa was kept a few moments waiting, and then, under a
strong guard, they were all carried to the Moro Castle, and lodged in
its dungeons, were left to await their trial.
Mateo and the rest of the men were put in a cell together, Willis,
for greater security, had been confined in a strong apartment alone.
It was the first time the slaver had ever been in prison, and the
close, dank air, the gloom, the high, dull, cold, stone walls, the
heavy fetters upon his limbs, the entire lack of any thing external to
distract his thoughts from his situation, all together, produced a
feeling of depression he had never known before.
Thus was he four days, with naught to while away the time but
his own thoughts, and they brought any thing but comfort to his
mind, for the past scenes of a misspent life were constantly
presenting themselves with the vividness of a panorama.
His early youth, when a good and gentle boy he had listened to
the kind admonitions of his excellent mother; then the loss of his
sweet parent, throwing him amongst selfish and careless relations;
his first steps in vice; then his desire to repent and reform; the cold
looks and want of sympathy with which he had been met; and
bitterly cursing the want of charity that had been so parsimonious of
kindness, when a few soothing words would have established him in
the road to rectitude, he looked at the darker deeds of the few last
years, and the end to which they would soon bring him.
Harassed by such painful reflections, it was a relief when the
jailor came to conduct him to trial, though he knew that with him
the road would be short from the tribunal to the gallows.
He felt that his fate was sealed; he had mortified De Vere so
much, by dismantling his vessel and killing so many of his men,
besides wounding him in the duel, that he knew the Englishman’s
influence would prevent his being treated with the least leniency,
and that the utmost penalty of the law would be exacted. He lacked
also that powerful friend, gold. Aware of the uncertain tenure one in
his profession had of life, he squandered the immense sums he
made as he got them, and he had not been allowed an opportunity
of obtaining aid from his associates.
It was with a mind conscious of the worst, and prepared to bear
it, that with a calm, determined countenance, and collected air, he
was confronted with his judges.
The indictment was read, and the presiding judge asked him if he
was “Guilty, or not guilty?”
“Guilty I am!” said Willis, “as who that hears me is not? but, that
I am more worthy of condemnation than even you, my judges, or
than the accuser, I deny! ’Tis true, I have been guilty of bringing
negroes from Africa to this island. But wherein am I thereby more
guilty than you? Do you not eagerly buy them as soon as landed;
and so hold out the temptation to bring them? ’Tis also true, that on
the high sea I did, with force and death, resist ‘her Britannic
Majesty’s vessel.’ Were moral right to prevail for once, her captain
would be in my situation; for by his intervention the slaves that I
would have brought here, to live in comfort to a good old age, will
now be condemned to hard and short lives, as apprentices, in Brazil.
But what avails my talking! My life, I know, is forfeited! and I will not
degrade myself by making useless efforts to save it.”
The counts in the indictment were all sustained. After a short
consultation, he was adjudged to die. And standing up to hear his
sentence, he found he was to be hung, the day after the morrow, to
the fore-yard of his own vessel. He then was carried back to his
dungeon.
After the captain had been sentenced, the rest of the crew were
brought up for trial; but being all men of little notoriety, and
pleading their necessity to obey the commands of Willis, and that
when they had joined the Maraposa they did not know she was a
slaver, they were all pardoned except Mateo, who was compelled to
pay a fine.
De Vere, after the trial, returned home exultingly; the man that
had caused him to be laughed at by the whole squadron, the one
who had nearly killed him, and again came within an ace of
capturing his brig, was about to be punished.
Clara was likewise glad to hear of Willis’s fate, for she hated him
for wounding her betrothed.
But Don Manuel learned the result of the trial with sadness; he
had tried to prevail upon De Vere not to prosecute, but the
Englishman said it was impossible; his sense of justice, his oath and
honor as an officer, all, he contended, compelled him to have the
law enforced; he had even made an effort to influence the court, but
found De Vere’s influence governed them all; he had not, however,
given up all hope yet.
Well was it for the secret of Francisca’s heart that the sentence of
Willis was conveyed to her in her own chamber, by the faithful
duenna, for as soon as she heard the awful news she sunk senseless
on the floor; swoon succeeded swoon for some time, but recovering,
in a degree, her composure, her eye brightened and her cheek
flushed, as if some happy idea had flashed across her mind, and
leaving the room she sought her father.
It was the night after the day of the trial, the bells of the many
churches had just ceased chiming ten, when the silence that reigned
in the slaver’s cell was broken by the sound of a key grating in the
lock of his door.
Surprised at having a visiter at so unusual an hour, Willis turned
to see why he was disturbed, and was astonished to discover, as the
door opened, by the light in the hands of the jailor, who remained in
the passage, a female figure, closely enveloped in the folds of a
large mantilla, glide into his dungeon. When within a few feet of
Willis, the lady paused, and, save the convulsive motion of her
breast, stood for a moment motionless. Then, slowly dropping the
mantilla from about her face, she revealed to the startled gaze of
the prisoner the features of Francisca, not as he had seen them, but
pale as death, and thin, as if she had lately been very ill.
Willis was about to speak, but raising her finger as a sign for him
to be silent, she said —
“Time is precious, Captain Willis, waste it not in inquiries or
conjectures of the cause of my being here, but believe that I am
deeply grateful for the life I owe you, and am desirous of repaying it
in kind. Every exertion has been made without success by my father
to procure your pardon, but my efforts have been more blessed. In
two hours the turnkey, who has been bribed, will let you out;
proceed to the nearest quay, where you will find all that is left of
your crew, waiting for you in a boat; take them to your schooner,
which is at anchor in the same place she was when you were
brought here; the few men in charge of her have also been bought;
and then to make your way out safely will have to depend upon
yourself.”
Again Willis endeavored to speak, and express his thanks, but
Francisca motioned him to hush.
“One moment more, and I must be gone. In this package,” she
handed him a small bundle, apparently of paper, “you will find that
which will be useful to you, if you get to sea. And praying that the
blessed Virgin will protect you, I wish you God speed.”
She turned, and was going, but Willis seized her hand for an
instant, and imprinting upon it a kiss, said, in a voice tremulous with
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookluna.com

You might also like