/usr/share/mozart/doc/apptut/DB.oz is in mozart-doc 1.4.0-8ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | functor
export
add: Add
get: Get
getAll: GetAll
remove: Remove
define
Data = {Dictionary.new}
Ctr = {New class $
prop locking
attr i:0
meth init(I <= 0)
lock i := I end
end
meth get($)
lock @i end
end
meth inc($)
lock I=@i+1 in i := I I end
end
end init()}
proc {Add X}
I={Ctr inc($)}
in
{Dictionary.put Data I X}
end
fun {Get ID}
{Dictionary.get Data ID}
end
fun {GetAll}
{Map {Dictionary.keys Data}
fun {$ K}
{AdjoinAt {Dictionary.get Data K} key K}
end}
end
proc {Remove ID}
{Dictionary.remove Data ID}
end
end
|