NodeBehavior
interface, and load it into the program, usually for use as an type
of intermediate node.
java -jar nodenet.jar
(using the executable jar)There are many ways to run the code in class. You should choose the one that your students are ready for. They are presented in an order that represents an increasing usage of the command line utilities and options.
1.)a) Click here b) File > Expand Classpath > (choose jar/dir of package of student code.) c) File > Load Behavior > (enter fully qualified Class name for student code) (requires Java WebStart). If you want to put a link on your course web site, you may use a link like this (subject to our terms of use like all materials on the site): <a href="http://www.cs101.org/psets/ballworld/demo/ballworld.jnlp">Click Here</a> 2. a) java -jar nodenet.jar b) File > Expand Classpath > (choose jar/dir of package of student code.) c) File > Load Behavior > (enter fully qualified Class name for student code) 3. a) java -cp nodenet.jar nodenet.Main b) File > Expand Classpath > (choose jar/dir of package of student code.) c) File > Load Behavior > (enter fully qualified Class name for student code) 4. a) java -cp "nodenet.jar:/path/to/student/code" nodenet.Main b) File > Load Behavior > (enter fully qualified Class name for student code) 5. a) java -cp "nodenet.jar:/path/to/student/code" nodenet.Main stupkg.StudentBehavior [stupkg.StudentBehavior2] 6. a) jar -xvf nodenet.jar b) java nodenet.Main c) File > Expand Classpath > (choose jar/dir of package of student code.) d) File > Load Behavior > (enter fully qualified Class name for student code) 7 thru 9 same permutations on the unpacked executable jar. 10 - 13 again but start with the source jar, add compilation step(s). (Line 6b assumes that you have the current directory on your default class path)
NodeBehavior
class the program looks for
public static final String NODE_BEHAVIOR
and
uses it's value to label the button. If this field does not appear in
the class, the node behavior's fully qualified class name is used
to label the button.
The screenshot below shows the program run with method 1 above, and a user loaded node behavior named Foo. Channels turn red when they are full to capacity. The channel on the right that has turned red has been configured to a capacity of 3 and a latency of 5000 miliseconds causing a traffic jam.
Packets are probably not being lost in this simulation despite the fact that 9 packets on the display and plus 89 at the terminator don't add up to 100 (matching the sum of the generators). There is definately one packet waiting to be transmitted in the upper right Intermediate node, and any one of the other intermediate nodes or the foo node might hold the last packet. To be sure that packets are not being held temporarily by student node behavior code one should disable all generators and let the simulation run until it seems to reach a steady state as shown below. Only after letting the network run without active generators can one be sure that a network is or is not dropping packets.