|
The FallingObject applet discussed in Lecture 11B will do fine as our physics simulator. FallingObject included both a physics generator and a simulated detector. Here the server will provide data from the detector, i.e. the histogram of falling time measurements, to DataClient requests. Two possible approaches to designing our new DataServer:
The latter approach is more in keeping with a building block, object oriented approach. However, for the sake of simplicity we will go with the first approach but try to maintain a clear separation of the objects. The FallingObject classes will be put into a package called FOExperiment. We will add some "Getter" methods, e.g. getNumData(), to the classes to provide access to properties of interest. (As opposed to allowing direct access to the variables and harming the encapsulation of our classes.) DataServer will add applet holder code, e.g. a Frame and menu (see Lecture 8A), where it will put the FallingObject applet. DataSender will replace the code that generates random data in run() with code that gets data from the detector in FallingObject.
|
||||||||||||
|
|||||||||||||