-
allFalse [testing]
^self carbon ~= true and:
[self oxygen ~= true and:
[self nitrogen ~= true
and: [self hydrogen ~= true and: [self others ~= true]]]]
-
allTrue [testing]
^self carbon = true and:
[self oxygen = true and:
[self nitrogen = true and: [self hydrogen = true and: [self others = true]]]]
-
asSettingArray [converting]
| aCollection |
aCollection := OrderedCollection new.
aCollection add: #carbon: -> self carbon.
aCollection add: #oxygen: -> self oxygen.
aCollection add: #nitrogen: -> self nitrogen.
aCollection add: #hydrogen: -> self hydrogen.
aCollection add: #others: -> self others.
^aCollection asArray
-
carbon [accessing]
^self carbonValueHolder value
-
carbon: aBoolean [accessing]
^self carbonValueHolder value: aBoolean = true
-
carbonValueHolder [aspects]
carbonValueHolder ifNil:
[carbonValueHolder := ValueHolder with: true.
carbonValueHolder
compute: [:value | self expressionValueHolder value: self computeExpression]].
^carbonValueHolder
-
compute: aBlock [constructing]
self expressionValueHolder compute: aBlock
-
computeExpression [private]
| aStream |
aStream := String new writeStream.
aStream nextPutAll: '[:index :atom | '.
self allTrue
ifTrue: [aStream nextPutAll: 'true']
ifFalse:
[self allFalse
ifTrue: [aStream nextPutAll: 'false']
ifFalse:
[self carbon
ifTrue: [aStream nextPutAll: '(atom = ''C'')']
ifFalse: [aStream nextPutAll: '(false)'].
aStream nextPutAll: ' | '.
self oxygen
ifTrue: [aStream nextPutAll: '(atom = ''O'')']
ifFalse: [aStream nextPutAll: '(false)'].
aStream nextPutAll: ' | '.
self nitrogen
ifTrue: [aStream nextPutAll: '(atom = ''N'')']
ifFalse: [aStream nextPutAll: '(false)'].
aStream nextPutAll: ' | '.
self hydrogen
ifTrue: [aStream nextPutAll: '(atom = ''H'')']
ifFalse: [aStream nextPutAll: '(false)'].
aStream nextPutAll: ' | '.
self others
ifTrue:
[aStream
nextPutAll: '((atom ~= ''C'') & (atom ~= ''O'') & (atom ~= ''N'') & (atom ~= ''H''))']
ifFalse: [aStream nextPutAll: '(false)']]].
aStream nextPutAll: ']'.
^aStream contents
-
expression [accessing]
^self expressionValueHolder value
-
expressionValueHolder [aspects]
expressionValueHolder
ifNil: [expressionValueHolder := ValueHolder with: self computeExpression].
^expressionValueHolder
-
getWindow [private]
^(ScheduledControllers scheduledControllers
detect: [:controller | controller model == self]
ifNone: [nil]) ifNil: [nil] ifNotNil: [:it | it view]
-
hydrogen [accessing]
^self hydrogenValueHolder value
-
hydrogen: aBoolean [accessing]
^self hydrogenValueHolder value: aBoolean = true
-
hydrogenValueHolder [aspects]
hydrogenValueHolder ifNil:
[hydrogenValueHolder := ValueHolder with: false.
hydrogenValueHolder
compute: [:value | self expressionValueHolder value: self computeExpression]].
^hydrogenValueHolder
-
initialize [initialize-release]
super initialize.
carbonValueHolder := nil.
oxygenValueHolder := nil.
nitrogenValueHolder := nil.
hydrogenValueHolder := nil.
othersValueHolder := nil.
expressionValueHolder := nil
-
nitrogen [accessing]
^self nitrogenValueHolder value
-
nitrogen: aBoolean [accessing]
^self nitrogenValueHolder value: aBoolean = true
-
nitrogenValueHolder [aspects]
nitrogenValueHolder ifNil:
[nitrogenValueHolder := ValueHolder with: true.
nitrogenValueHolder
compute: [:value | self expressionValueHolder value: self computeExpression]].
^nitrogenValueHolder
-
others [accessing]
^self othersValueHolder value
-
others: aBoolean [accessing]
^self othersValueHolder value: aBoolean = true
-
othersValueHolder [aspects]
othersValueHolder ifNil:
[othersValueHolder := ValueHolder with: true.
othersValueHolder
compute: [:value | self expressionValueHolder value: self computeExpression]].
^othersValueHolder
-
oxygen [accessing]
^self oxygenValueHolder value
-
oxygen: aBoolean [accessing]
^self oxygenValueHolder value: aBoolean = true
-
oxygenValueHolder [aspects]
oxygenValueHolder ifNil:
[oxygenValueHolder := ValueHolder with: true.
oxygenValueHolder
compute: [:value | self expressionValueHolder value: self computeExpression]].
^oxygenValueHolder
-
setting [accessing]
| aCollection |
aCollection := OrderedCollection new: 5.
aCollection add: #carbon: -> self carbon.
aCollection add: #oxygen: -> self oxygen.
aCollection add: #nitrogen: -> self nitrogen.
aCollection add: #hydrogen: -> self hydrogen.
aCollection add: #others: -> self others.
^aCollection
-
setting: settingCollection [accessing]
settingCollection do:
[:anAssociation |
| aSelector aBoolean |
aSelector := anAssociation key asSymbol.
aBoolean := anAssociation value = true.
self perform: aSelector with: aBoolean]