[Gd-chatter] r10890 - trunk/www/books/dpg
tim at gwydiondylan.org
tim at gwydiondylan.org
Mon Sep 4 03:46:27 CEST 2006
Author: tim
Date: Mon Sep 4 03:46:26 2006
New Revision: 10890
Added:
trunk/www/books/dpg/figure-7.2.png (contents, props changed)
trunk/www/books/dpg/figure-7.3.png (contents, props changed)
Modified:
trunk/www/books/dpg/db_98.html
Log:
job: website
image replacements for figures 7.2 and 7.3 plus additional html cleanup
Modified: trunk/www/books/dpg/db_98.html
==============================================================================
--- trunk/www/books/dpg/db_98.html (original)
+++ trunk/www/books/dpg/db_98.html Mon Sep 4 03:46:26 2006
@@ -2,18 +2,18 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <link title="main style sheet" rel="stylesheet" href="dpg.css" type="text/css" />
- <link rel="top" href="db_1.html" />
- <link rel="up" href="db_92.html" />
- <link rel="prev" href="db_97.html" />
- <link rel="next" href="db_99.html" />
- <title>Dylan Programming: 7.6 Meeting of angles and times</title>
- </head>
+ <head>
+ <link title="main style sheet" rel="stylesheet" href="dpg.css" type="text/css" />
+ <link rel="top" href="db_1.html" />
+ <link rel="up" href="db_92.html" />
+ <link rel="prev" href="db_97.html" />
+ <link rel="next" href="db_99.html" />
+ <title>Dylan Programming: 7.6 Meeting of angles and times</title>
+ </head>
<body>
<div class="navigation">
- <p><a href="db_99.html" accesskey="n"><img src="next.gif" alt="next" /></a> <a href="db_97.html" accesskey="p"><img src="prev.gif" alt="previous" /></a> <a href="db_1.html" accesskey="t"><img src="top.gif" alt="top" /></a> <a href="db_2.html" accesskey="c"><img src="content.gif" alt="contents" /></a> <a href="db_349.html" accesskey="i"><img src="index.gif" alt="index" /></a></p>
+ <p><a href="db_99.html" accesskey="n"><img src="next.gif" alt="next" /></a> <a href="db_97.html" accesskey="p"><img src="prev.gif" alt="previous" /></a> <a href="db_1.html" accesskey="t"><img src="top.gif" alt="top" /></a> <a href="db_2.html" accesskey="c"><img src="content.gif" alt="contents" /></a> <a href="db_349.html" accesskey="i"><img src="index.gif" alt="index" /></a></p>
</div>
<div class="content" id="heading98-0">
@@ -23,55 +23,72 @@
define abstract class <sixty-unit> (<object>)
slot total-seconds :: <integer>, init-keyword: total-seconds:;
end class <sixty-unit>;
-define method decode-total-seconds
+
+define method decode-total-seconds
(sixty-unit :: <sixty-unit>)
=> (max-unit :: <integer>, minutes :: <integer>, seconds :: <integer>)
decode-total-seconds(abs(sixty-unit.total-seconds));
end method decode-total-seconds;
-define method encode-total-seconds
- (max-unit :: <integer>, minutes :: <integer>, seconds :: <integer>)
+
+define method encode-total-seconds
+ (max-unit :: <integer>, minutes :: <integer>, seconds :: <integer>)
=> (total-seconds :: <integer>)
((max-unit * 60) + minutes) * 60 + seconds;
-end method encode-total-seconds;
+end method encode-total-seconds;
</pre>
<p>We redefine the time and angle classes and methods to take advantage of the new <code><sixty-unit></code> class:</p>
<pre>
define abstract class <time> (<sixty-unit>)
-end class <time>;
+end class <time>;
+
define abstract class <angle> (<sixty-unit>)
-end class <angle>;
+end class <angle>;
+
define method say (angle :: <angle>) => ()
let(degrees, minutes, seconds) = decode-total-seconds(angle);
format-out("%d degrees %d minutes %d seconds",
degrees, minutes, seconds);
-end method say;
-<em>// definition unchanged, repeated for completeness
-</em>define abstract class <directed-angle> (<angle>)
+end method say;
+
+<em>// definition unchanged, repeated for completeness</em>
+define abstract class <directed-angle> (<angle>)
slot direction :: <string>, init-keyword: direction:;
-end class <directed-angle>;
+end class <directed-angle>;
+
define method say (angle :: <directed-angle>) => ()
next-method();
format-out(" %s", angle.direction);
-end method say;
-<em>// definition unchanged, repeated for completeness
-</em>define class <relative-angle> (<angle>)
+end method say;
+
+<em>// definition unchanged, repeated for completeness</em>
+define class <relative-angle> (<angle>)
end class <relative-angle>;
-<em>// we need to show degrees for <relative-angle>, but do not need to show
-// minutes and seconds,so we override the method on <angle>
-</em>define method say (angle :: <relative-angle>) => ()
+
+<em>// we need to show degrees for <relative-angle>, but do not need to show</em>
+<em>// minutes and seconds,so we override the method on <angle></em>
+define method say (angle :: <relative-angle>) => ()
format-out(" %d degrees", decode-total-seconds(angle));
-end method say;
+end method say;
+
define method say (position :: <relative-position>) => ()
format-out("%d miles away at heading ", position.distance);
say(position.angle);
-end method say;
+end method say;
</pre>
<p>To see the complete library, and the test code that creates position instances and calls <code>say</code> on them, see <a href="db_103.html#marker-9-278">Chapter 8, <em>A Simple Library</em></a>.</p>
<p><a href="#marker-9-259">Figure 7.2</a> shows the inheritance relationships of the classes. When one class inherits from another, the relationship is sometimes called the <a name="marker-2-270"></a><strong>is-a relationship</strong>. For example, a direct instance of <code><time-offset></code> <em>is a</em> <code><time></code> as well, and it <em>is a</em> <code><sixty-unit></code>.</p>
-<table><caption>Figure 7.2 <a name="marker-9-259"></a>Is-a relationships (inheritance) among classes, shown by arrows. Abstract classes are shown in <em>oblique</em> <em>typewriter</em> <em>font.</em></caption><tr><td><p><img alt="db98im14" src="db98im14.gif" /></p>
+<table><caption>Figure 7.2 <a name="marker-9-259"></a>Is-a relationships (inheritance) among classes, shown by arrows. Abstract classes are shown in <em>oblique</em> <em>typewriter</em> <em>font.</em></caption><tr><td><p><img alt="Figure 7.2" src="figure-7.2.png" /></p>
</td></tr></table><p>The classes have another kind of relationship as well — one class can use another class as the type of a slot, in what is called the <a name="marker-2-271"></a><strong>has-a relationship</strong>. <a href="#marker-9-260">Figure 7.3</a> shows both the inheritance relationships, and the relationships of one class using another class as the type of a slot.</p>
-<table><caption>Figure 7.3 <a name="marker-9-260"></a>Has-a relationships among classes, shown by dashed arrows.</caption><tr><td><p><img alt="db98im15" src="db98im15.gif" /></p>
-</td></tr></table>
+ <table>
+ <caption>Figure 7.3 <a name="marker-9-260"></a>Has-a relationships among classes, shown by dashed arrows.</caption>
+ <tr>
+ <td>
+ <p>
+ <img alt="Figure 7.3" src="figure-7.3.png" />
+ </p>
+ </td>
+ </tr>
+ </table>
</div>
<div class="toc">
@@ -83,10 +100,10 @@
<address>Dylan Programming - 9 Apr 1999</address>
</div>
<div class="navigation">
- <p><a href="db_99.html" accesskey="n"><img src="next.gif" alt="next" /></a> <a href="db_97.html" accesskey="p"><img src="prev.gif" alt="previous" /></a> <a href="db_1.html" accesskey="t"><img src="top.gif" alt="top" /></a> <a href="db_2.html" accesskey="c"><img src="content.gif" alt="contents" /></a> <a href="db_349.html" accesskey="i"><img src="index.gif" alt="index" /></a></p>
+ <p><a href="db_99.html" accesskey="n"><img src="next.gif" alt="next" /></a> <a href="db_97.html" accesskey="p"><img src="prev.gif" alt="previous" /></a> <a href="db_1.html" accesskey="t"><img src="top.gif" alt="top" /></a> <a href="db_2.html" accesskey="c"><img src="content.gif" alt="contents" /></a> <a href="db_349.html" accesskey="i"><img src="index.gif" alt="index" /></a></p>
</div>
<div class="copyright">
- <p>N Feinberg/S E Keene/R Mathews/P Tucker Withington, DYLAN PROGRAMMING, (c) 1997 Harlequin Inc. Reproduced by permission of Addison-Wesley Longman Publishing Company, Inc. All rights reserved. No further copying, downloading or transmitting of this material is allowed without the prior written permission of the publisher.</p>
+ <p>N Feinberg/S E Keene/R Mathews/P Tucker Withington, DYLAN PROGRAMMING, (c) 1997 Harlequin Inc. Reproduced by permission of Addison-Wesley Longman Publishing Company, Inc. All rights reserved. No further copying, downloading or transmitting of this material is allowed without the prior written permission of the publisher.</p>
</div>
</body>
</html>
Added: trunk/www/books/dpg/figure-7.2.png
==============================================================================
Binary file. No diff available.
Added: trunk/www/books/dpg/figure-7.3.png
==============================================================================
Binary file. No diff available.
More information about the chatter
mailing list