smalltalk
/
osmo-st-all
Archived
1
0
Fork 0
This repository has been archived on 2022-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
osmo-st-all/grease/Core/Text/GRSignPrinter.st

36 lines
775 B
Smalltalk

GRPrinter subclass: GRSignPrinter [
| negativePrinter positivePrinter |
<comment: nil>
<category: 'Grease-Core-Text'>
negativePrinter: aPrinter [
"The printer to be used when the number is negative."
<category: 'accessing'>
negativePrinter := aPrinter
]
positivePrinter: aPrinter [
"The printer to be used when the number is zero or positive."
<category: 'accessing'>
positivePrinter := aPrinter
]
initialize [
<category: 'initialization'>
super initialize.
self negativePrinter: $-.
self positivePrinter: nil
]
print: anObject on: aStream [
<category: 'printing'>
anObject negative
ifTrue: [negativePrinter print: anObject on: aStream]
ifFalse: [positivePrinter print: anObject on: aStream]
]
]