Skip to content

Commit

Permalink
classified methods, renaming, helper methods
Browse files Browse the repository at this point in the history
  • Loading branch information
oleschl committed Jul 12, 2020
1 parent 97300dc commit 901630c
Show file tree
Hide file tree
Showing 29 changed files with 46 additions and 40 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
instance creation
on: aDocument

^ self basicNew on: aDocument
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
stop conditions
beginningOfStructure
| currentStructures nextStructures diff |
| diff |

self position + 1 > self readLimit ifTrue: [^ nil].
currentStructures := self collection attributesAt: self position.
nextStructures := self collection attributesAt: self position + 1.
diff := nextStructures difference: currentStructures.
diff := self structureDifferenceBetween: self position + 1 and: self position.
^ diff isEmpty
ifTrue: [nil]
ifFalse: [{#beginningOfStructure. diff}]

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
currentCharacter

^ self text at: self position
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
stop conditions
endOfStructure
| currentStructures nextStructures diff |
| diff |

self position + 1 > self readLimit ifTrue: [^ nil].
currentStructures := self collection attributesAt: self position.
nextStructures := self collection attributesAt: self position + 1.
diff := currentStructures difference: nextStructures.
diff := self structureDifferenceBetween: self position and: self position + 1.
^ diff isEmpty
ifTrue: [nil]
ifFalse: [{#endOfStructure. diff}]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
stop conditions
lineBreak

^ ((self collection at: self position) = Character lf)
^ self currentCharacter = Character lf
ifTrue: [#lineFeed]
ifFalse: [nil]
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ next
startPosition := self position.
[self stopConditions isEmpty]
whileTrue: [self position: self position + 1].
^ {self collection copyFrom: startPosition to: self position. self stopConditions}
^ {self text copyFrom: startPosition to: self position. self stopConditions}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
stop conditions
paragraph

^ ((self collection at: self position) = self paragraphCharacter)
^ self currentCharacter = self paragraphCharacter
ifTrue: [#paragraph]
ifFalse: [nil]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
constants
paragraphCharacter

^Character value: 182
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
stop conditions
accessing
stopConditions

^ {self endOfDocument.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
stop conditions
structureDifferenceBetween: firstPosition and: secondPosition

^ (self text attributesAt: firstPosition) difference: (self text attributesAt: secondPosition)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
text: aText

collection := aText
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
collection
text

^ collection
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@
"class" : {
"on:" : "kh 7/3/2020 19:29" },
"instance" : {
"beginningOfStructure" : "OS 7/4/2020 23:05",
"collection" : "kh 7/3/2020 19:51",
"collection:" : "kh 7/3/2020 19:51",
"beginningOfStructure" : "OS 7/12/2020 18:48",
"currentCharacter" : "OS 7/12/2020 18:42",
"endOfDocument" : "kh 7/3/2020 20:05",
"endOfStructure" : "OS 7/4/2020 23:05",
"lineBreak" : "kh 7/3/2020 19:40",
"next" : "kh 7/3/2020 20:08",
"endOfStructure" : "OS 7/12/2020 18:23",
"lineBreak" : "OS 7/12/2020 18:41",
"next" : "OS 7/12/2020 18:13",
"on:" : "kh 7/3/2020 19:30",
"paragraph" : "OS 7/4/2020 20:39",
"paragraph" : "OS 7/12/2020 18:42",
"paragraphCharacter" : "OS 7/4/2020 20:38",
"readLimit" : "kh 7/3/2020 19:56",
"readLimit:" : "kh 7/3/2020 19:56",
"stopConditions" : "OS 7/4/2020 23:01" } }
"stopConditions" : "OS 7/4/2020 23:01",
"structureDifferenceBetween:and:" : "OS 7/12/2020 18:21",
"text" : "OS 7/12/2020 18:12",
"text:" : "OS 7/12/2020 18:12" } }
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
constants
boldTextStructure

^ TextStructure bold
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
accessing
document

^ self editorModel bufferDocument
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
utilities
isBeginningOfStructure: aListElement

^ aListElement first = #beginningOfStructure
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
utilities
isEndOfStructure: listElement

^ listElement first = #endOfStructure
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
utilities
isParagraph: aListElement

^ aListElement = #paragraph
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
constants
italicTextStructure

^ TextStructure italic
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
constants
paragraphCharacter

^ Character value: 182
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
acceptance-tests
testUS59EndOfStructureAndBeginOfStructureIncludeStructure

| stream stopConditions |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
acceptance-tests
testUS59NextReturnsNextSectionOfTextAndListOfStopConditions

| testText stream |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
acceptance-tests
testUS59ReadStreamExists

self assert: (Smalltalk hasClassNamed: #DocumentReadStream)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
acceptance-tests
testUS59StopConditionsAreInCorrectOrder

| stream stopConditions |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
as yet unclassified
constants
textWithAttributes

| text |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"commentStamp" : "",
"instvars" : [
],
"name" : "RichTextDocumentReadStream",
"name" : "RichTextDocumentReadStreamTests",
"pools" : [
],
"super" : "RichTextEditorTestCase",
Expand Down

0 comments on commit 901630c

Please sign in to comment.