Trapped-Counter.st 549 B

12345678910111213141516171819202122232425262728293031323334
  1. Smalltalk createPackage: 'Trapped-Counter'!
  2. (Smalltalk packageAt: 'Trapped-Counter') imports: {'trapped/Trapped-Processors'}!
  3. Object subclass: #TrappedCounter
  4. instanceVariableNames: 'value'
  5. package: 'Trapped-Counter'!
  6. !TrappedCounter methodsFor: 'accessing'!
  7. value
  8. ^value
  9. !
  10. value: aNumber
  11. value := aNumber
  12. ! !
  13. !TrappedCounter methodsFor: 'action'!
  14. decrement
  15. value := value - 1
  16. !
  17. increment
  18. value := value + 1
  19. ! !
  20. !TrappedCounter methodsFor: 'initialization'!
  21. initialize
  22. super initialize.
  23. value := 0.
  24. self axxord: SimpleAxon new
  25. ! !