benchs: add pep8analisis bench program
[nit.git] / tests / bench_netsim.nit
index 6a9ade7..f14a17b 100644 (file)
@@ -23,7 +23,7 @@ class Node
 end
 
 class WakeUpNode
-special Node
+       super Node
        fun wake_up is abstract
        # Wake up the node
        fun wake_up_in(d: Int)
@@ -35,13 +35,12 @@ special Node
 end
 
 class NodeSource
-special Node
+       super Node
        var _nexts: nullable ArraySet[NodeSink] = null
        fun attach(n: NodeSink)
        # 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]
@@ -53,7 +52,6 @@ special Node
        # Remove the sink `n' from the connected nodes
        # Do nothing if `n' is not connected
        do
-               assert n != null
                _nexts.remove(n)
        end
 
@@ -70,7 +68,7 @@ special Node
 end
 
 class NodeSink
-special Node
+       super Node
        fun recieve(n: NodeSource) is abstract
        # the `n' has emeted a signal
 end
@@ -109,7 +107,7 @@ class Scheduler
 
        fun run_for(time_limit: Int)
        do
-               while true do
+               loop
                        var node = next_event 
                        if _time > time_limit then
                                print("Time limit.")
@@ -131,8 +129,8 @@ end
 #
 
 class BeepSource
-special NodeSource
-special WakeUpNode
+       super NodeSource
+       super WakeUpNode
        redef fun wake_up
        do
                send
@@ -153,7 +151,7 @@ special WakeUpNode
 end
 
 class CountSink
-special NodeSink
+       super NodeSink
        readable var _count: Int = 0
        redef fun recieve(n: NodeSource)
        do
@@ -162,7 +160,7 @@ special NodeSink
 end
 
 class SimpleCountSink
-special CountSink
+       super CountSink
 
        init(name: String)
        do
@@ -171,8 +169,8 @@ special CountSink
 end
 
 class NodeAlternate
-special NodeSink
-special NodeSource
+       super NodeSink
+       super NodeSource
        var _last: nullable NodeSource
        redef fun recieve(n: NodeSource)
        do
@@ -189,8 +187,8 @@ special NodeSource
 end
 
 class NodeEat
-special CountSink
-special NodeSource
+       super CountSink
+       super NodeSource
        var _limit: Int
        redef fun recieve(n: NodeSource)
        do
@@ -211,9 +209,9 @@ special NodeSource
 end
 
 class NodeDelay
-special NodeSource
-special NodeSink
-special WakeUpNode
+       super NodeSource
+       super NodeSink
+       super WakeUpNode
        var _delay: Int
        redef fun recieve(n: NodeSource)
        do