These pages demonstrate, with screen shots, source code and javadoc web pages, the completion of a tiny but complete example of some simulation code. The example uses three classes, Simulation, User and Phone. A single instance of Simulation is created which in turn creates a single User and a single Phone. The system is then stepped through three cycles (three steps in time), though each time it does the same thing as before because it is such a simple example. Each module also reports on what it is doing with print statements. With a large system it would be better to log the activity of the system to a file, where it could be studied. (Or in unix, the output could be redirected to a file or looked at with more.
Here is the source code for all three Java files which include Javadoc-styled comments.
Here are the . Javadoc pages that document the API for the Demo1 project, based on the Javadoc-styled comments in the three files.
The screen shots below all show telnet windows when logged into one of the CCS Sun Solaris (Sun's Unix) machines. (Actually the machine in my office alphacentauri). They were shot on my G4 Mac running NCSA Telnet. I also have a Sun workstation of my own at home and some future shots may come from it. Most of the shots have comment lines preceded by "cmnt" which is the name of an empty script allowing me to type whatever I want on the rest of the line as a comment [there must be an easier way to do this].
The first figure below shows creating a directory demo1, moving to it with cd and preparing to create and edit a new file User.java. I stopped at that point, since executing the command would clear the screen and replace it with the emacs editor (in the figure after this).
The figure below shows the Emacs editor in action. The status line at the bottom shows two asterisks, '**', indicating that the text in the buffer hasn't been saved since some change(s) have been made. It also shows that Emacs is in the Java mode which means it will attempt to indent properly and will indicate where matching braces are. It also indicates that All of the file is in view and the line number the cursor is on, L20.
This figure shows compiling and running the simulation (the main() function in the Simulation class). The results are the printouts from the various modules as they are stepped or explicitly called.
The figure below shows creating a subdirector for the javadoc pages, which I chose
to call jdocs. The line
javadoc -version -author -d jdocs *.java
creates the javadoc web pages and tells javadoc to include version and author information and to place all the files in my jdocs directory. All the source files are compiled at once, indicated by *.java. The line
cp -r jdocs ~/.www/teaching/com1204sp2001/demo1/
copies jdocs and all its contents to my web pages directory. If you follow this link
http://www.ccs.neu.edu/home/futrelle/teaching/com1204sp2001/demo1/jdocs/ you will see the web pages it produced. (At a later time I used the -windowtitle javadoc option in addition, to add the title to the window you'll see when you follow this link.)