Grafoscopio/src/Grafoscopio/GrafoscopioAbstractText.cla...

123 lines
2.9 KiB
Smalltalk

"
This abstract class works for defining the basic type required by Rubric
"
Class {
#name : #GrafoscopioAbstractText,
#superclass : #Object,
#category : #'Grafoscopio-Pillar'
}
{ #category : #converting }
GrafoscopioAbstractText >> asText [
^ self
]
{ #category : #accessing }
GrafoscopioAbstractText >> at: anIndex [
^ self subclassResponsibility
]
{ #category : #accessing }
GrafoscopioAbstractText >> attributesAt: characterIndex [
"Answer the code for characters in the run beginning at characterIndex."
"NB: no senders any more (supplanted by #attributesAt:forStyle: but retained for the moment in order not to break user code that may exist somewhere that still calls this"
| attributes |
" self size = 0
ifTrue: [^ Array with: (TextFontChange new fontNumber: 1)]."
self size = 0 ifTrue: [ ^#()].
attributes := self runs at: characterIndex.
^ attributes
]
{ #category : #accessing }
GrafoscopioAbstractText >> attributesAt: anInteger forStyle: aTextStyle [
| attributes |
self size = 0
ifTrue: [^ Array with: (TextFontChange new fontNumber: aTextStyle defaultFontIndex)]. "null text tolerates access"
attributes := self runs at: anInteger.
^ attributes
]
{ #category : #copying }
GrafoscopioAbstractText >> copy [
^ self
]
{ #category : #copying }
GrafoscopioAbstractText >> copyFrom: start to: stop [
^ self subclassResponsibility
]
{ #category : #testing }
GrafoscopioAbstractText >> ifNotEmpty: isNotEmptyBlock ifEmpty: isEmptyBlock [
^ self isEmpty
ifTrue: [ isEmptyBlock value ]
ifFalse: [ isNotEmptyBlock value ]
]
{ #category : #testing }
GrafoscopioAbstractText >> isEmpty [
^ self size = 0
]
{ #category : #testing }
GrafoscopioAbstractText >> isText [
^ true
]
{ #category : #accessing }
GrafoscopioAbstractText >> last [
^ self at: self size
]
{ #category : #copying }
GrafoscopioAbstractText >> notEmpty [
^ self isEmpty not
]
{ #category : #removing }
GrafoscopioAbstractText >> removeAttribute: anAttr [
^ self removeAttribute: anAttr from: 1 to: self size
]
{ #category : #removing }
GrafoscopioAbstractText >> removeAttribute: att from: start to: stop [
self subclassResponsibility
]
{ #category : #editing }
GrafoscopioAbstractText >> replaceFrom: anInteger to: anInteger2 with: aCollection [
self subclassResponsibility
]
{ #category : #emphasis }
GrafoscopioAbstractText >> runLengthFor: characterIndex [
^ self runs runLengthAt: characterIndex
]
{ #category : #accessing }
GrafoscopioAbstractText >> runs [
self subclassResponsibility
]
{ #category : #accessing }
GrafoscopioAbstractText >> runs: anArray [
self subclassResponsibility "runs := RunArray new: self size withAll: anArray . "
]
{ #category : #accessing }
GrafoscopioAbstractText >> size [
^ self string size
]
{ #category : #accessing }
GrafoscopioAbstractText >> string [
^ self subclassResponsibility
]
{ #category : #accessing }
GrafoscopioAbstractText >> text: aParam [
self subclassResponsibility
]