forked from ObjectProfile/PythonBridge
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathPBCommandFactory.class.st
More file actions
55 lines (47 loc) · 1.35 KB
/
PBCommandFactory.class.st
File metadata and controls
55 lines (47 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Class {
#name : #PBCommandFactory,
#superclass : #LanguageLinkCommandFactory,
#category : #'PythonBridge-Execution'
}
{ #category : #bindings }
PBCommandFactory >> addBinding: aBinding [
bindingsDictionary at: aBinding pythonVariable name put: aBinding object.
^ aBinding
]
{ #category : #bindings }
PBCommandFactory >> bindingAt: varName put: anObject [
bindingsDictionary at: varName put: anObject.
^ PBBinding key: varName wrap: anObject
]
{ #category : #bindings }
PBCommandFactory >> bindingWrap: anObject [
^ self addBinding: (PBBinding wrap: anObject)
]
{ #category : #accessing }
PBCommandFactory >> decorateTransform: aBlock [
| previousBlock |
previousBlock := transformBlock.
^ transformBlock := [ :obj | aBlock value: (previousBlock value: obj) ]
]
{ #category : #initialization }
PBCommandFactory >> initialize [
super initialize.
self reset
]
{ #category : #observers }
PBCommandFactory >> linkObserverClass [
^ PBObserver
]
{ #category : #initialization }
PBCommandFactory >> reset [
instructions := OrderedCollection new.
bindingsDictionary := Dictionary new.
observers := OrderedCollection new.
command := PBCommand new.
transformBlock := #yourself
]
{ #category : #initialization }
PBCommandFactory >> setNotifyToInstruction: aP3gInstruction [
^ 'notify' asP3GIdentifier
callWith: (Array with: aP3gInstruction with: command id)
]