23.11.2014 Views

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

To convert the generic Merge class <strong>in</strong>to useful classes, we must extend it with<br />

classes that redef<strong>in</strong>e the three auxiliary methods, aIsLess, bothAreEqual,<br />

<strong>and</strong> bIsLess. We show how union, <strong>in</strong>tersection, <strong>and</strong> subtraction can be easily<br />

described <strong>in</strong> terms of these methods <strong>in</strong> Code Fragment 11.10. The auxiliary<br />

methods are redef<strong>in</strong>ed so that the template method merge performs as follows:<br />

718

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!