Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
21
Task/Object-serialization/E/object-serialization-1.e
Normal file
21
Task/Object-serialization/E/object-serialization-1.e
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
def makeEvent(time :int) {
|
||||
return def event {
|
||||
to __printOn(out) { out.print(`@@$time`) }
|
||||
to __optUncall() { return [makeEvent, "run", [time]] }
|
||||
to getTime() { return time }
|
||||
}
|
||||
}
|
||||
|
||||
def makeArrival(time :int, what :any, position :int) {
|
||||
return def arrival extends makeEvent(time) {
|
||||
to __printOn(out) {
|
||||
out.print(`$what to $position $super`)
|
||||
}
|
||||
to __optUncall() {
|
||||
return [makeArrival, "run", [time, what, position]]
|
||||
}
|
||||
|
||||
to getWhat() { return what }
|
||||
to getPosition() { return position }
|
||||
}
|
||||
}
|
||||
3
Task/Object-serialization/E/object-serialization-2.e
Normal file
3
Task/Object-serialization/E/object-serialization-2.e
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
def surgeon := <import:org.erights.e.elib.serial.makeSurgeon>().diverge()
|
||||
surgeon.addExit(makeEvent, "makeEvent")
|
||||
surgeon.addExit(makeArrival, "makeArrival")
|
||||
6
Task/Object-serialization/E/object-serialization-3.e
Normal file
6
Task/Object-serialization/E/object-serialization-3.e
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
def objs := [makeEvent(timer.now()),
|
||||
makeArrival(timer.now(), "Smith", 7)]
|
||||
|
||||
stdout.println(objs)
|
||||
<file:objects.dat>.setBytes(surgeon.serialize(objs))
|
||||
stdout.println(surgeon.unserialize(<file:objects.dat>.getBytes()))
|
||||
Loading…
Add table
Add a link
Reference in a new issue