Skip to content

Commit c700320

Browse files
committed
Implemented DataSeriesInternal
1 parent b543e5a commit c700320

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+258
-108
lines changed
Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,6 @@
11
*DataFrame-Core
22
asDataSeries
3+
"Converts a collection to Array and constructs a DataSeries from its values"
34

4-
| allInstancesOf |
5-
6-
allInstancesOf := [ :aClass |
7-
self detect: [ :x |
8-
(x isKindOf: aClass) not ]
9-
ifFound: [ false ]
10-
ifNone: [ true ] ].
11-
12-
(allInstancesOf value: Number) ifTrue: [
13-
^ DataSeriesNumeric newFrom: self ].
14-
15-
(allInstancesOf value: String) ifTrue: [
16-
"Can we convert it to DataSeriesTime?"
17-
[ ^ DataSeriesTime newFrom: self ]
18-
on: Error do: [ "nothing" ] ].
19-
20-
"Either everything is a String, or none of the above is satisfied. In any case, we convert everything to String"
21-
^ DataSeriesText newFrom: self
5+
^ DataSeries fromArray: self asArray.
226

DataFrame-Core.package/DataFrameInternal.class/instance/^equals.st

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ comparing
1111
(self at: i at: j) = each
1212
ifFalse: [ ^ false ] ].
1313

14-
^ true
14+
^ true.
1515

1616

1717

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
accessing
22
at: rowIndex at: columnIndex
33

4-
^ matrix at: rowIndex at: columnIndex
4+
^ contents at: rowIndex at: columnIndex.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
accessing
22
at: rowIndex at: columnIndex put: value
33

4-
^ matrix at: rowIndex at: columnIndex put: value.
4+
^ contents at: rowIndex at: columnIndex put: value.

DataFrame-Core.package/DataFrameInternal.class/instance/collect..st

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ enumerating
22
collect: aBlock
33

44
^ self class fromMatrix:
5-
(matrix collect: aBlock).
5+
(contents collect: aBlock).

DataFrame-Core.package/DataFrameInternal.class/instance/columnAt..st

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ accessing
22
columnAt: aNumber
33

44
^ (1 to: self numberOfRows) collect: [ :i |
5-
self at: i at: aNumber ]
5+
self at: i at: aNumber ].
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
accessing
22
columnsAt: anArrayOfNumbers
33

4-
| df numberOfRows numberOfColumns |
4+
| dfInternal numberOfRows numberOfColumns |
55

66
numberOfRows := self numberOfRows.
77
numberOfColumns := anArrayOfNumbers size.
8-
df := DataFrameInternal new: (numberOfRows @ numberOfColumns).
8+
dfInternal := DataFrameInternal new: (numberOfRows @ numberOfColumns).
99

1010
1 to: numberOfRows do: [ :i |
1111
anArrayOfNumbers doWithIndex: [ :j :k |
12-
df at: i at: k put: (self at: i at: j) ] ].
12+
dfInternal at: i at: k put: (self at: i at: j) ] ].
1313

14-
^ df
14+
^ dfInternal.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
copying
22
deepCopy
33

4-
^ DataFrameInternal fromMatrix: matrix
4+
^ self class fromMatrix: contents.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
enumerating
22
do: aBlock
33

4-
^ matrix do: aBlock
4+
^ contents do: aBlock.
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
initialization
22
initialize: aPoint
3-
4-
super initialize.
53

6-
matrix := Matrix
4+
contents := Matrix
75
rows: aPoint x
86
columns: aPoint y.
97

10-
^ self
8+
^ self.

0 commit comments

Comments
 (0)