-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds possibility to use functions between cells. #5
- Loading branch information
Showing
19 changed files
with
170 additions
and
5 deletions.
There are no files selected for viewing
16 changes: 12 additions & 4 deletions
16
...s/Spreadsheet-Core.package/SpreadsheetAbstractTextMorph.class/instance/calculateResult.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...eadsheet-Core.package/SpreadsheetGrid.class/instance/getCellContentForPointCollection..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
layout | ||
getCellContentForPointCollection: aCollection | ||
"return a cell collection for a collection of points" | ||
|
||
| cellContentCollection singleCell cellText | | ||
cellContentCollection := OrderedCollection new. | ||
aCollection do: [ :each | | ||
singleCell := self cellAtRowIndex: each y colIndex: each x. | ||
Transcript show: each. | ||
Transcript show: singleCell contentMorph. | ||
cellText := singleCell cell contents. | ||
(cellText) ifNotEmpty: [ | ||
cellContentCollection add: cellText | ||
] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
4 changes: 4 additions & 0 deletions
4
packages/Spreadsheet-Core.package/SpreadsheetMath.class/class/listOfReduceOperations.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
as yet unclassified | ||
listOfReduceOperations | ||
|
||
^{#*. #+. #/} |
13 changes: 13 additions & 0 deletions
13
packages/Spreadsheet-Core.package/SpreadsheetMath.class/class/perform.on..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
as yet unclassified | ||
perform: anOperation on: aCollection | ||
"perfrom the given operation on the given collection using the regex matcher" | ||
|
||
(self listOfReduceOperations includes: anOperation) | ||
ifTrue: [ | ||
^ aCollection reduce: anOperation | ||
]. | ||
(aCollection respondsTo: anOperation) | ||
ifTrue: [ | ||
^ aCollection perform: anOperation | ||
]. | ||
^ self |
6 changes: 6 additions & 0 deletions
6
packages/Spreadsheet-Core.package/SpreadsheetMath.class/methodProperties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"class" : { | ||
"listOfReduceOperations" : "JU 5/29/2018 17:02", | ||
"perform:on:" : "JU 5/29/2018 17:02" }, | ||
"instance" : { | ||
} } |
14 changes: 14 additions & 0 deletions
14
packages/Spreadsheet-Core.package/SpreadsheetMath.class/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"category" : "Spreadsheet-Core", | ||
"classinstvars" : [ | ||
], | ||
"classvars" : [ | ||
], | ||
"commentStamp" : "", | ||
"instvars" : [ | ||
], | ||
"name" : "SpreadsheetMath", | ||
"pools" : [ | ||
], | ||
"super" : "Object", | ||
"type" : "normal" } |
Empty file.
9 changes: 9 additions & 0 deletions
9
packages/Spreadsheet-Core.package/SpreadsheetRegexMatcher.class/class/functionsDict.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
as yet unclassified | ||
functionsDict | ||
"dict mapping the regex to the function" | ||
|
||
^ Dictionary newFrom: { | ||
#'sum(.*)' -> #sum. | ||
#'max(.*)' -> #max. | ||
#'prod(.*)' -> #*. | ||
} |
22 changes: 22 additions & 0 deletions
22
.../Spreadsheet-Core.package/SpreadsheetRegexMatcher.class/class/getCellIndicesForString..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
as yet unclassified | ||
getCellIndicesForString: aString | ||
"extracts the indices for a given string" | ||
|
||
| cellRegex cellString cellCollection fromCellPoint toCellPoint cellPointCollection | | ||
cellRegex := '[a-zA-Z]+[0-9]+' asRegex. | ||
|
||
cellString := self getCellstringFromString: aString. | ||
cellCollection := cellRegex matchesIn: cellString. | ||
cellPointCollection := OrderedCollection new. | ||
|
||
self assert: cellCollection size > 1. | ||
fromCellPoint := self getColumnAndRowFromCellLabel: (cellCollection at: 1). | ||
toCellPoint :=self getColumnAndRowFromCellLabel: (cellCollection at: 2). | ||
|
||
(fromCellPoint x) to: (toCellPoint x) do: [ :xDim | | ||
(fromCellPoint y) to: (toCellPoint y) do: [ :yDim | | ||
cellPointCollection add: (xDim@yDim) | ||
] | ||
]. | ||
^cellPointCollection | ||
|
7 changes: 7 additions & 0 deletions
7
.../Spreadsheet-Core.package/SpreadsheetRegexMatcher.class/class/getCellstringFromString..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
as yet unclassified | ||
getCellstringFromString: aString | ||
"get the substring describing the cells 'a7:b8' from the string" | ||
|
||
| cellsRegex | | ||
cellsRegex := '[a-zA-Z]+[0-9]+\:[a-zA-Z]+[0-9]+' asRegex. | ||
^(cellsRegex matchesIn: aString) first |
9 changes: 9 additions & 0 deletions
9
...adsheet-Core.package/SpreadsheetRegexMatcher.class/class/getColumnAndRowFromCellLabel..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
as yet unclassified | ||
getColumnAndRowFromCellLabel: aLabel | ||
"split a cell label into a char and a digit and convert the char to a digit >> return column and row as vector" | ||
|
||
| char charAsDigit digit | | ||
char := aLabel first. | ||
charAsDigit := self getNumberFromChar: char. | ||
digit := aLabel allButFirst asNumber. | ||
^charAsDigit@digit |
14 changes: 14 additions & 0 deletions
14
...es/Spreadsheet-Core.package/SpreadsheetRegexMatcher.class/class/getFunctionFromString..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
as yet unclassified | ||
getFunctionFromString: aString | ||
"return a function embedded within a string" | ||
|
||
| functionsDict matcher | | ||
functionsDict := self functionsDict. | ||
functionsDict keys do: [ :each | | ||
matcher := each asRegex. | ||
(matcher matches: aString) ifTrue: [ | ||
^functionsDict at: each | ||
] | ||
]. | ||
^nil | ||
|
13 changes: 13 additions & 0 deletions
13
packages/Spreadsheet-Core.package/SpreadsheetRegexMatcher.class/class/getNumberFromChar..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
as yet unclassified | ||
getNumberFromChar: aChar | ||
"convert a char to an integer value via the asciiValue" | ||
|
||
| asciiVal | | ||
asciiVal := aChar asCharacter asciiValue. | ||
(asciiVal > 64 and: asciiVal < 91) ifTrue: [ | ||
^asciiVal - 64 | ||
]. | ||
(asciiVal > 96 and: asciiVal < 123) ifTrue: [ | ||
^asciiVal - 96 | ||
]. | ||
^false |
5 changes: 5 additions & 0 deletions
5
packages/Spreadsheet-Core.package/SpreadsheetRegexMatcher.class/class/hasOperation..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
as yet unclassified | ||
hasOperation: anOperation | ||
"checks if operation exists in functionsDict" | ||
|
||
^self functionsDict values includes: anOperation |
11 changes: 11 additions & 0 deletions
11
packages/Spreadsheet-Core.package/SpreadsheetRegexMatcher.class/methodProperties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"class" : { | ||
"functionsDict" : "JU 5/29/2018 15:35", | ||
"getCellIndicesForString:" : "JU 5/29/2018 23:50", | ||
"getCellstringFromString:" : "JU 5/29/2018 23:46", | ||
"getColumnAndRowFromCellLabel:" : "JU 5/29/2018 16:27", | ||
"getFunctionFromString:" : "JU 5/29/2018 17:25", | ||
"getNumberFromChar:" : "JU 5/29/2018 16:17", | ||
"hasOperation:" : "JU 5/29/2018 16:55" }, | ||
"instance" : { | ||
} } |
14 changes: 14 additions & 0 deletions
14
packages/Spreadsheet-Core.package/SpreadsheetRegexMatcher.class/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"category" : "Spreadsheet-Core", | ||
"classinstvars" : [ | ||
"statements" ], | ||
"classvars" : [ | ||
], | ||
"commentStamp" : "", | ||
"instvars" : [ | ||
], | ||
"name" : "SpreadsheetRegexMatcher", | ||
"pools" : [ | ||
], | ||
"super" : "Object", | ||
"type" : "normal" } |