University of Alabama
Department of Computer Science
Intervalare incorrect. They should be This means that you have to implement all of the methods in the superclass hierarchy of
subclassResponsibility selfin them, e.g.
firstKey. The template for
(class Interval SequenceableCollection (n m k) (classMethod from:to: (from to) ... ) (classMethod from:to:by: (from to by) ... ) (method firstKey () ... ) (method lastKey () ... ) (method at:ifAbsent: (index exnBlock) ... ) (method at:put: (key value) (error: self #can't-add-to-an-Interval)) (method species () Interval) (method printName () (print #Interval)) (method remove:ifAbsent: (oldObject exnBlock) (error: self #can't-delete-from-an-Interval)) (method associationsDo: (aBlock) ... ) )And here is an example interaction:
-> (val myIntv (from:to: Interval 2 6)) Interval( 2 3 4 5 6 ) -> (firstKey myIntv) 1 -> (lastKey myIntv) 5 -> (at:put: myIntv -1 -1) run-time error: can't-add-to-an-Interval -> (do: myIntv (block (x) (begin (print #inDo:) (println x)))) inDo:2 inDo:3 inDo:4 inDo:5 inDo:6 nil -> (species myIntv) <class Interval> -> (printName myIntv) IntervalInterval -> (remove:ifAbsent: myIntv 1 [(println #inAbsentBlock)]) run-time error: can't-delete-from-an-Interval -> (associationsDo: myIntv (block (association) (begin (print (key association)) (print #:) (println (value association))))) 1:2 2:3 3:4 4:5 5:6 nil ->
Interval.smtto mailto:firstname.lastname@example.org?subject=CS603MP4jones@cs.ua.edu with a subject line of
CS603MP4. If it all possible, try to send this from the email account you placed on the index card. In any case, be sure that your name is included in both program source files and in the body of your email message. Comments in -smalltalk are written using a semi-colon:
; This is a commentBe sure to follow the guidelines below:
Intervalmust be present.
This document was generated using the LaTeX2HTML translator Version 2K.1beta (1.61)
Copyright © 1993, 1994, 1995, 1996,
Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999, Ross Moore, Mathematics Department, Macquarie University, Sydney.
The command line arguments were:
latex2html -split 0 -nonavigation MP4.tex
The translation was initiated by on 2003-04-16