Skip to content
Permalink
Browse files

2.3 / Create ObscuringReferences class.

  • Loading branch information
yujihamaguchi committed Dec 28, 2019
1 parent cb9cab7 commit d7ff7fe5fcb6bbec78dbd3bd16434ee8f5ae331c
@@ -0,0 +1,13 @@
Class {
#name : #ObscuringReferencesTest,
#superclass : #TestCase,
#category : #'Example-OOD-Tests'
}

{ #category : #tests }
ObscuringReferencesTest >> testDiameters [
| obscuringReferences |
obscuringReferences := ObscuringReferences
data: #(#(622 20) #(622 23) #(559 30) #(559 40)).
self assert: obscuringReferences diameters equals: #(662 668 619 639)
]
@@ -0,0 +1,29 @@
Class {
#name : #ObscuringReferences,
#superclass : #Object,
#instVars : [
'data'
],
#category : #'Example-OOD'
}

{ #category : #'instance creation' }
ObscuringReferences class >> data: aData [
^ self basicNew setData: aData
]

{ #category : #private }
ObscuringReferences >> data [
^ data
]

{ #category : #calculating }
ObscuringReferences >> diameters [
^ self data collect: [ :cell | (cell at: 1) + ((cell at: 2) * 2) ]
]

{ #category : #private }
ObscuringReferences >> setData: aData [
data := aData.
^ self
]

0 comments on commit d7ff7fe

Please sign in to comment.
You can’t perform that action at this time.