ProtoObject subclass: #ExtendedCounter
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'NU-Stuff'!
"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
ExtendedCounter class
instanceVariableNames: 'parent returnlist hasparent children '!
!ExtendedCounter class methodsFor: 'as yet unclassified' stamp: 'ss 9/22/2000 14:26'!
child: aCounter
children add: aCounter.! !
!ExtendedCounter class methodsFor: 'as yet unclassified' stamp: 'ss 9/22/2000 14:26'!
getParent
Transcript show: parent asString.
^ parent! !
!ExtendedCounter class methodsFor: 'as yet unclassified' stamp: 'ss 9/22/2000 14:30'!
getchildren
children do: [:x | Transcript show: x asString].
^ children! !
!ExtendedCounter class methodsFor: 'as yet unclassified' stamp: 'ss 9/22/2000 14:24'!
inc
count _ count + 1.
children do: [:x | x zero]! !
!ExtendedCounter class methodsFor: 'as yet unclassified' stamp: 'ss 9/22/2000 14:30'!
nestedVal
| temp1 temp2 |
returnlist _ Set new.
( hasparent )
ifTrue: [
temp1 _ Set new.
temp2 _ Set new.
returnlist add: ( self val ).
temp1 _ parent nestedVal.
temp1 do: [:x | temp2 add: x].
temp1 _ temp2.
temp1 do: [:x | returnlist add: x].
^ returnlist
]
ifFalse: [
returnlist add: ( self val ).
^ returnlist
]! !
!ExtendedCounter class methodsFor: 'as yet unclassified' stamp: 'ss 9/22/2000 14:23'!
new
count _ 0.
parent _ nil.
hasparent _ false.
children _ Set new.! !
!ExtendedCounter class methodsFor: 'as yet unclassified' stamp: 'ss 9/22/2000 14:25'!
setParent: aCounter
parent _ aCounter.
hasparent _ true.
parent child: self.
^ parent! !
!ExtendedCounter class methodsFor: 'as yet unclassified' stamp: 'ss 9/22/2000 14:25'!
setval: int
count _ int.
children do: [:x | x zero].
^ int! !
!ExtendedCounter class methodsFor: 'as yet unclassified' stamp: 'ss 9/22/2000 14:23'!
zero
self setval: 0.! !