Department of Computer Science and Engineering, IIT Kanpur

CS210: Data Structures

Dr. R. K. Ghosh


Home | Notice Board | Instructor | TAs | Students | Assignments | Schedule | Lectures | Resources

Solution to Assignment 6

We see how we can implement the needed class and in addition a sample class structure is given .

Setting up of a phone call to moblie phone
The class structure will consist of a record about its HLR , its current location - depending on whether the phone is wihthin its home location or in some other visitor location. Similarly the home location of a phone will keep record of other "visitor" phones in its area.
A record of whether a phone is busy or not is also kept. Each phones record is kept updated by telling the visitor locator in case a phone comes into others area.
To find out the callee phone a separate function is needed, which can see for the location of callee in the HLR of the caller. In case it is not found , the search will be done in the VLRs .
The sample class
//Structure of class containing information about each mobile phone
public class phone
{
long HLR    //stores phones in HLR
int HLR_stat   //Status of phone (perhaps busy!)
int HLR_loc    //stores current location (in which cell)
long VLR    //stores phone in VLR
int VLR_loc   //stores home location
//function to return the current location of phone
public int loc(long num)
{
index=Arrays.Search(HLR,num);
if(index>=0)
return HLR_loc[index];
else
return 0;//not found
}
//function to update VLR of phone
public void setlocvlr(long num,int loc) //updates the vlr of mobile no
{
index=Arrays.Search(VLR,num);
if(index>=0)
{
VLR[VLR_PTR++]=num;
VLR_loc[index]=loc;
}
}
//other required functions
}
//An applet can be added to add niceties by drawing the location of caller
//and callee and the path of connection setup.





Home | Notice Board | Instructor | TAs | Students | Assignments | Schedule | Lectures | Resources
Page last updated 20 Aug, 2002 by Manish Agarwal