[Newbies] closed and open interval
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
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 ;)
mail: filet00 at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners