Grafoscopio

View Ticket
Login
Ticket UUID: ffb08a5973bfc7365aae9c0a627a50733d66c83b
Title: Logic error in GrafoscopioNode>>#ancestors
Status: Closed Type: Code_Defect
Severity: Important Priority: Immediate
Subsystem: Resolution: Fixed
Last Modified: 2017-01-08 18:25:27
Version Found In: 245
User Comments:
krodelin added as text/x-fossil-plain on 2017-01-01 13:38:37:
The current implementation GrafoscopioNode>>#ancestors IMHO contains a logic error. I.e. #level is sent to (parent) instances even if they are nil. The problem is in the way the while loop traverses the parent hierarchy. Fixed code below:

ancestors
	"I return a collection of all the nodes wich are ancestors of the receiver node"

	| currentNode ancestors |
	currentNode := self.
	ancestors := OrderedCollection new.
	[ currentNode parent notNil and: [ currentNode level > 0 ] ]
		whileTrue: [ ancestors add: currentNode parent.
			currentNode := currentNode parent ].
	ancestors := ancestors reversed.
	^ ancestors

offray added as text/x-fossil-plain on 2017-01-08 18:25:27:
Fixed on Grafoscopio-OffrayLuna.248. Please update from Monticello.