private double calculateFinishTime(Packet np, double nextTime)
    {
        double time = 0;
        double ratio = 0;

        try
        {
            int type = np.getNetServiceType();
            if (type >= weights.length)   // out of bound array error checking
            {
                System.out.println(name_ +".calculateFinishTime(): Warning - " +
                    " packet class = " + type + ", weight.length = " +
                    weights.length);
                type = 0;
            }

            ratio = np.getSize() / weights[type];
        }
        catch(Exception e) {
            ratio = 1;  // default ratio if an error occurs
        }

        if (nextTime > CF) {
                time = nextTime + ratio;
        }
        else {
            time = CF + ratio;
        }

        return time;
    }