nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
pep8analysis: intro a feature to clear the list of errors/notes
[nit.git]
/
tests
/
bench_netsim.nit
diff --git
a/tests/bench_netsim.nit
b/tests/bench_netsim.nit
index
d4a9122
..
ae42bee
100644
(file)
--- a/
tests/bench_netsim.nit
+++ b/
tests/bench_netsim.nit
@@
-32,6
+32,7
@@
class WakeUpNode
_scheduler.add_event(self, d)
end
var _scheduler: Scheduler
_scheduler.add_event(self, d)
end
var _scheduler: Scheduler
+ init do end
end
class NodeSource
end
class NodeSource
@@
-41,7
+42,6
@@
class NodeSource
# Add the sink `n' the the connected nodes
# Do nothing if `n' is already connected
do
# Add the sink `n' the the connected nodes
# Do nothing if `n' is already connected
do
- assert n != null
# Create the collection if needed
if _nexts == null then
_nexts = new ArraySet[NodeSink]
# Create the collection if needed
if _nexts == null then
_nexts = new ArraySet[NodeSink]
@@
-53,7
+53,6
@@
class NodeSource
# Remove the sink `n' from the connected nodes
# Do nothing if `n' is not connected
do
# Remove the sink `n' from the connected nodes
# Do nothing if `n' is not connected
do
- assert n != null
_nexts.remove(n)
end
_nexts.remove(n)
end
@@
-109,7
+108,7
@@
class Scheduler
fun run_for(time_limit: Int)
do
fun run_for(time_limit: Int)
do
- while true do
+ loop
var node = next_event
if _time > time_limit then
print("Time limit.")
var node = next_event
if _time > time_limit then
print("Time limit.")
@@
-154,10
+153,10
@@
end
class CountSink
super NodeSink
class CountSink
super NodeSink
- readable var _count: Int = 0
+ var count: Int = 0
redef fun recieve(n: NodeSource)
do
redef fun recieve(n: NodeSource)
do
- _count = _count + 1
+ count = count + 1
end
end
end
end
@@
-194,12
+193,12
@@
class NodeEat
var _limit: Int
redef fun recieve(n: NodeSource)
do
var _limit: Int
redef fun recieve(n: NodeSource)
do
- var c = _count + 1
+ var c = count + 1
if c >= _limit then
if c >= _limit then
- _count = 0
+ count = 0
send
else
send
else
- _count = c
+ count = c
end
end
end
end