-
Notifications
You must be signed in to change notification settings - Fork 28
4. Accessing elements of DataSeries
Oleksandr Zaytsev edited this page Jan 10, 2018
·
1 revision
When accessing the elements of a DataSeries, you can think of is as an Array. at:
message allows you to access elements by their index, with at:put:
you can modify the given element.
series at: 2. "b"
series at: 3 put: 'x'.
Besides the standard Array accessors, DataSeries provides additional operations for accessing elements by their keys
series atKey: #k2. "b"
series atKey: #k3 put: 'x'.
Messages for enumerating, such as do:
or withIndexDo:
work the same as in Array, and the collect:
message creates a new DataSerie preserving the name and keys of the receiver.
newSeries := series collect: [ :each | each, 'x' ].
newSeries name. "letters"
newSeries atKey: 'k1'. "ax"