Concurrent Programming with Java
Lab Manual, Version 1.0, F. Astha Ekadiyanto, 2002.

[Contents] [Next] [Previous]

Lab 2: Building Application


Create Rbs Objects and Cell objects

There are nine Rbs objects and Cell objects in the topology. This example will only create one of them and leave the others for individual practice.
Creating Rbs will not be as simple as creating Msc. First of all, there are three Rbs constructors. Choosing the correct constructor will make life easier. We will choose the constructor with the biggest number of arguments since it enables most of the Rbs fields to be initiated correctly.

Definitely, filling the Rbs constructor arguments is not so easy since both the arguments require objects and not a primitive datatype. The String ID argument object however is easy to construct by just keying in "RBS-1" which will automatically declares the String Object construction. The Cell servicecell argument requires a little bit more work to do. Since we don't yet have a cell in the system, we will have to create one first that represent the area managed by the RBS-1. Just leave the Create Object - window for Rbs open while we create the corresponding Cell.

Create the SquareCell for RBS-1

Create the SquareCell for RBS-1 by choosing the new SquareCell(x,y,r) constructor.

The arguments are from the primitive datatypes (double), thus we can key in them directly.

Now we have a SquareCell object that we can pass into the arguments for constructing Rbs. Just select the Cell serviceCell input box, and click on the SquareCe_1 object at the Object Panel (on just type them without quote marks).

Now, at least we have three objects in the Object Panel. Among these objects, the Cell objects (SquareCe_1) can be removed immediately after assigned into Rbs because we will not need the reference to these objects again. If we need to access the Cell objects, simply access the through the Rbs.

 


[Contents] [Next] [Previous]