[ENH] IntegerPrintOnPadding

Alexander at Lazarevic.de Alexander at Lazarevic.de
Mon Mar 29 17:47:19 UTC 2004


Hi Stef!

This might have edges, but maybe starting point.

Alex

> So what do you prefer? I like the idea of alexander. Alexander do you 
> want to do it? I can review it that way. Now I'm the middle of an 
> export/import facility for ThreadNavigator so that I stop to lose time for building demoes.

from preamble:

"Change Set:		IntegerPrintOnPadding
Date:			29 March 2004
Author:			Alexander Lazarevic

This changeset improves and changes (a little) the way integers can be
printend in different numeratives.

* The meaning of printStringBase has changed. printStringBase: will just
print
a number in any base and the (new) storeStringBase: will print the
number with a leading base.

Examples:

3994 printStringBase: 16	-->	'F9A'
3994 storeStringBase: 16	-->	'16rF9A'

* The new method printOn:base:length:padded: (et al) helps formatting
output a little.

Examples:

3735928559 printStringBase: 16 length: 20 padded: false	-->	'           
DEADBEEF'
3735928559 printStringBase: 16 length: 20 padded: true	-->
'000000000000DEADBEEF'
3735928559 storeStringBase: 16 length: 20 padded: true	-->
'16r000000000DEADBEEF'
-3735928559 storeStringBase: 16 length: 20 padded: false	-->	'       
-16rDEADBEEF'

* Some redundant code got removed, some methods got deprecated and some
moved.As one
result Fractions now can also respond to printOn:base: like Integers and
Floats (just to be consistent).

Examples:
(15/11) printStringBase: 16	-->	'(F/B)'
(15/11) storeStringBase: 16	-->	'(16rF/16rB)'
		
The following worked before:
(16rF/16rB) printString	-->	'(15/11)'

* For more examples see the IntegerPrintOnPaddingTests changeset and the
classes IntegerTests and
FrationTests
"!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: IntegerPrintOnPadding.cs.gz
Type: application/octet-stream
Size: 2000 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20040329/c8c273af/IntegerPrintOnPadding.cs.obj


More information about the Squeak-dev mailing list