[Newbies] closed and open interval

Filip Malczak filet00 at gmail.com
Mon Nov 24 16:18:27 UTC 2008

You can always make subclass of Interval for example OpenedInterval , add
two variables: left and right.Make new methods:
OpenedInterval>>from: aNumber to: aNumber left: aBoolean
OpenedInterval>>from: aNumber to: aNumber right: aBoolean
OpenedInterval>>from: aNumber to: aNumber left: aBoolean right: aBoolean

they should create standard Interval and write aBoolean to variables left
and right; lets say that true for opened form left/right and false for
closed. Then add methods
OpenedInterval>>includes: aNumber
that checks if aNumber is one of borders and founds if left or right is
opened/closed. If aNumber is border which should be closed, then uses super
include, else answer false. Easy, aint it?
You can add accessors and setters for left and right, so that you can
open/close intervals without making new one, and check state of variables.

You know, you gave me some ideas, that I would be pleased to work out :P I
will make this class up and make it public ;)

GG: 2486889
mail: filet00 at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20081124/b81130bd/attachment.htm

More information about the Beginners mailing list