71 lines
1.8 KiB
Smalltalk
71 lines
1.8 KiB
Smalltalk
Class {
|
|
#name : #GrafoscopioPillarRuns,
|
|
#superclass : #Object,
|
|
#instVars : [
|
|
'ast',
|
|
'lastBranch',
|
|
'lastAttributes'
|
|
],
|
|
#category : #'Grafoscopio-Pillar'
|
|
}
|
|
|
|
{ #category : #accessing }
|
|
GrafoscopioPillarRuns >> ast: anAst [
|
|
ast := anAst
|
|
]
|
|
|
|
{ #category : #'basic api' }
|
|
GrafoscopioPillarRuns >> at: anIndex [
|
|
| newBranch |
|
|
newBranch := ast detectFullBranchFor: anIndex.
|
|
newBranch = lastBranch
|
|
ifTrue: [ .^ lastAttributes ].
|
|
lastBranch := newBranch.
|
|
^ lastAttributes := self calculateAttributesForBranch: lastBranch at: anIndex
|
|
]
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
GrafoscopioPillarRuns >> calculateAttributesForBranch: aCollection at: anIndex [
|
|
| visitor |
|
|
visitor := GrafoscopioFlatAttributeVisitor new.
|
|
visitor index: anIndex.
|
|
aCollection do: [ :n | n accept: visitor ].
|
|
^ visitor attributes
|
|
]
|
|
|
|
{ #category : #'basic api' }
|
|
GrafoscopioPillarRuns >> isEmpty [
|
|
^ ast isNil or: [ ast isEmpty ]
|
|
]
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
GrafoscopioPillarRuns >> rangeOf: aTextURL startingAt: anInteger [
|
|
self assert: (aTextURL isKindOf: TextAction).
|
|
|
|
((self at: anInteger) contains: [ : a | (a isKindOf: TextAction)]) ifTrue: [
|
|
(ast extractStringFrom: anInteger to: (ast detectAstNodeFor: anInteger ) textStop) traceCr.
|
|
^ anInteger to: (ast detectAstNodeFor: anInteger ) textStop
|
|
].
|
|
^ 0 to: 0
|
|
]
|
|
|
|
{ #category : #'basic api' }
|
|
GrafoscopioPillarRuns >> reset [
|
|
lastAttributes := nil.
|
|
lastBranch := nil.
|
|
]
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
GrafoscopioPillarRuns >> runLengthFor: anInteger [
|
|
| node |
|
|
anInteger > ast size ifTrue: [ ^0 ].
|
|
node := (ast detectAstNodeFor: anInteger).
|
|
^ node textStop - anInteger.
|
|
]
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
GrafoscopioPillarRuns >> withStartStopAndValueDo: aBlockClosure [
|
|
thisContext sender asString traceCr.
|
|
'Should implement' traceCr.
|
|
]
|