Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
41
Task/Object-serialization/J/object-serialization-1.j
Normal file
41
Task/Object-serialization/J/object-serialization-1.j
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
lin_z_=:5!:5
|
||||
serializeObject=:3 :0
|
||||
p=. copath y
|
||||
d=. ;LF;"1(,'=:';lin__y)"0 nl__y i.4
|
||||
'(',(5!:5<'p'),')(copath[cocurrent@])cocreate ''''',,d,LF
|
||||
)
|
||||
|
||||
deserializeObject=:3 :0
|
||||
o=.conl 1
|
||||
0!:100 y
|
||||
(conl 1)-.o
|
||||
)
|
||||
|
||||
coclass'room'
|
||||
create=:3 :'size=:y'
|
||||
print=:3 :'''room size '',":size'
|
||||
|
||||
coclass'kitchen'
|
||||
coinsert'room'
|
||||
print=:3 :'''kitchen size '',":size'
|
||||
|
||||
coclass'kitchenWithSink'
|
||||
coinsert'kitchen'
|
||||
print=:3 :'''kitchen with sink size '',":size'
|
||||
|
||||
cocurrent'base'
|
||||
|
||||
R=:'small' conew 'room'
|
||||
K=:'medium' conew 'kitchen'
|
||||
S=:'large' conew 'kitchenWithSink'
|
||||
print__R''
|
||||
print__K''
|
||||
print__S''
|
||||
|
||||
|
||||
(;<@serializeObject"0 R,K,S) 1!:2 <'objects.dat'
|
||||
|
||||
'r1 k1 s1'=: <"0 deserializeObject 1!:1<'objects.dat'
|
||||
print__r1''
|
||||
print__k1''
|
||||
print__s1''
|
||||
17
Task/Object-serialization/J/object-serialization-2.j
Normal file
17
Task/Object-serialization/J/object-serialization-2.j
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
print__R''
|
||||
room size small
|
||||
print__K''
|
||||
kitchen size medium
|
||||
print__S''
|
||||
kitchen with sink size large
|
||||
|
||||
|
||||
(;<@serializeObject"0 R,K,S) 1!:2 <'objects.dat'
|
||||
|
||||
'r1 k1 s1'=: <"0 deserializeObject 1!:1<'objects.dat'
|
||||
print__r1''
|
||||
room size small
|
||||
print__k1''
|
||||
kitchen size medium
|
||||
print__s1''
|
||||
kitchen with sink size large
|
||||
Loading…
Add table
Add a link
Reference in a new issue