import java.util.*;

public class Node {
       int costs[][]=new int [4][4];
       int mincosts[]=new int [4];
       int dest[]=null;
       ArrayList packets=new ArrayList();
       Simulator sim=null;


       /**
        *@param args
        */

public RoutingPacket creatertpkt(int srcid, int destid,int mincosts[])
{
        RoutingPacket oRPacket =new RoutingPacket();
        oRPacket.setSourceid(srcid);
        oRPacket.setDestid(destid);
        oRPacket.setMincost(mincosts);

return oRPacket;
}
void rtinit(int srcid,int dest[], int initcosts[][],int initMinCosts[],Simulator s)
{
        System.out.println("Entering rtinit\n");

        costs=initcosts;
        mincosts=initMinCosts;
        sim=s;
        this.dest=dest;
        for(int i=0; i<dest.length ;i++)sim.toLayer2(creatertpkt(srcid,dest[i],mincosts));

        //packets.add(creatertpkt(srcid,dest[i].mincosts));
        printTable();
}
public void rtupdate(RoutingPacket oReceivedPacket){


        System.out.println("Entering rtupdate");
        int destid, i,j;
        int srcid = oReceivedPacket.sourceid;

        for(destid=0; destid < 4; destid++)
        {
            int mincosts12[] = {999,999,999,999};

            //if there is a new min distance
            if (oReceivedPacket.mincost[destid]!=999)
                {
            //update distance table

            this.costs[destid][srcid] = this.costs[srcid][srcid] + oReceivedPacket.mincost[destid];
            //find new min for the destination cost
            if(this.costs[destid][srcid]<this.mincosts[destid]){

            //update min cost table
                    this.mincosts[destid] =this.costs[destid][srcid];
                    mincosts12[destid] =this.costs[destid][srcid];

            //send new minimum value to all its neighbors

                    for(int k=0;k<this.dest.length;k++)sim.toLayer2(creatertpkt(srcid,this.dest[k],mincosts12));

                }
            }

        }
            printTable();


}


void printTable()
{


    System.out.println("         via   \n");
    System.out.println(" D01 | 1    2   3 \n");
    System.out.println(" ===|==============\n");
    System.out.println("    1| "+costs[1][1]+" "+costs[1][2]+" "+costs[1][3]);
    System.out.println("    2| "+costs[2][1]+" "+costs[2][2]+" "+costs[2][3]);
    System.out.println("    3| "+costs[3][1]+" "+costs[3][2]+" "+costs[3][3]);

}

}

cannot find symbol oRPacket.setDestid(destid);

what RoutingPacket class are you using?
it looks like it hasn't got a setDestid method which takes a single int as a parameter.

Here is the RoutingPacket class, thank you for the reply. Am I missing anything here?

public class RoutingPacket {

        int sourceid;  /*id of sending router sending this pkt */
        int destid;    /*id of router to thich pkt being sent (must ne an immediate neighbor) */
        int mincost[]=new int[4];  /*min cost to node 0...3 */
        public int getDestid() {
            return destid;

        }    
        public void setDist(int destid) {
            this.destid = destid;
        }
        public int[] getMincost() {
            return mincost;
        }
        public void setMincost(int[] mincost) {
            this.mincost = mincost;
        }
        public int getSourceid() {
            return sourceid;
        }
        public void setSourceid(int sourceid) {
            this.sourceid = sourceid;
        }

    }       






    int sourceid;  /*id of sending router sending this pkt */
    int destid;    /*id of router to thich pkt being sent (must ne an immediate neighbor) */
    int mincost[]=new int[4];  /*min cost to node 0...3 */
    public int getDestid() {
        return destid;

    }    
    public void setDist(int destid) {
        this.destid = destid;
    }
    public int[] getMincost() {
        return mincost;
    }
    public void setMincost(int[] mincost) {
        this.mincost = mincost;
    }
    public int getSourceid() {
        return sourceid;
    }
    public void setSourceid(int sourceid) {
        this.sourceid = sourceid;
    }

}       

Line 10 - the method name is spelled differently

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.