MapBusesRoute/src/java/src/GetStats.java
/**
     * Processes requests for both HTTP
     * <code>GET</code> and
     * <code>POST</code> methods.
     *
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
Processes requests for both HTTP
GET and
POST methods.

@param request servlet request
@param response servlet response
@throws ServletException if a servlet-specific error occurs
@throws IOException if an I/O error occurs
Processes requests for both HTTP GET and POST methods . @param request servlet request @param response servlet response @throws ServletException if a servlet - specific error occurs @throws IOException if an I / O error occurs
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException, FileNotFoundException, ParseException {
        int edge1=Integer.parseInt(request.getParameter("edge1"));
        int edge2=Integer.parseInt(request.getParameter("edge2"));
        int edge3=Integer.parseInt(request.getParameter("edge3"));
        ArrayList<String> route=new ArrayList<String>();
        route.add("EF-CD");route.add("CD-AA");route.add("AA-BB");route.add("EF-FG");route.add("FG-VV");route.add("VV-BB");
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out=response.getWriter();
        BufferedReader br=new BufferedReader(new FileReader("C:\\Users\\Server\\Documents\\NetBeansProjects\\MapBusesRoute\\estimated values.txt"));
        String line=br.readLine();
        HashMap<String,String> hm=new HashMap<String,String>();
        while(line!=null)
        {
            String tokens[]=line.split(",");
            hm.put(tokens[3], tokens[1]);
            line=br.readLine();
        }
        String result=route.get(edge1)+": "+hm.get(route.get(edge1))+"<br/>"+route.get(edge2)+": "+hm.get(route.get(edge2))+"<br/>"+route.get(edge3)+": "+hm.get(route.get(edge3))+"<br/> ";
StringTokenizer st = new StringTokenizer(result1, "$$$");
String parts[] = result1.split("$$$");
String a = st.nextToken();
String b = st.nextToken();
System.out.println(a);
System.out.println(b);
String result = "";
Functions f=new Functions();
if(Integer.parseInt(item)==0){
    result = f.getMean(edge);
}
if(Integer.parseInt(item)==1){
    result = f.getMedian(edge);
}
if(Integer.parseInt(item)==2){
    result = f.getVariance(edge);
}
if(Integer.parseInt(item)==3){
    result = f.getSD(edge);
}
if(Integer.parseInt(item)==4){
    result = f.getMeanDay(edge, date);
}
if(Integer.parseInt(item)==5){
    result = f.getMedianDay(edge, date);
}
if(Integer.parseInt(item)==6){
    result = f.getVarianceDay(edge, date);
}
if(Integer.parseInt(item)==7){
    result = f.getSDDay(edge, date);
}
if(Integer.parseInt(item)==8){
    result = f.getMeanTime(edge, time);
}
if(Integer.parseInt(item)==9){
    result = f.getMedianTime(edge, time);
}
if(Integer.parseInt(item)==10){
    result = f.getVarianceTime(edge, time);
}
if(Integer.parseInt(item)==11){
    result = f.getSDTime(edge, time);
}
if(Integer.parseInt(item)==12){
    result = f.getState(edge, date, time);
}
        out.write(" "+result);
    }
protected void processRequest ( HttpServletRequest request , HttpServletResponse response ) throws ServletException , IOException , FileNotFoundException , ParseException { int edge1 = Integer . parseInt ( request . getParameter ( "edge1" ) ) ; int edge2 = Integer . parseInt ( request . getParameter ( "edge2" ) ) ; int edge3 = Integer . parseInt ( request . getParameter ( "edge3" ) ) ; ArrayList < String > route = new ArrayList < String > ( ) ; route . add ( "EF-CD" ) ; route . add ( "CD-AA" ) ; route . add ( "AA-BB" ) ; route . add ( "EF-FG" ) ; route . add ( "FG-VV" ) ; route . add ( "VV-BB" ) ; response . setContentType ( "text/html;charset=UTF-8" ) ; PrintWriter out = response . getWriter ( ) ; BufferedReader br = new BufferedReader ( new FileReader ( "C:\\Users\\Server\\Documents\\NetBeansProjects\\MapBusesRoute\\estimated values.txt" ) ) ; String line = br . readLine ( ) ; HashMap < String , String > hm = new HashMap < String , String > ( ) ; while ( line != null ) { String tokens [ ] = line . split ( "," ) ; hm . put ( tokens [ 3 ] , tokens [ 1 ] ) ; line = br . readLine ( ) ; } String result = route . get ( edge1 ) + ": " + hm . get ( route . get ( edge1 ) ) + "<br/>" + route . get ( edge2 ) + ": " + hm . get ( route . get ( edge2 ) ) + "<br/>" + route . get ( edge3 ) + ": " + hm . get ( route . get ( edge3 ) ) + "<br/> " ; out . write ( " " + result ) ; }
Processes requests for both HTTP
 <code>GET</code> and
 <code>POST</code> methods.
Processes requests for both HTTP <code > GET< / code > and <code > POST< / code > methods .
//System.out.println(edge1); //        ReverseGeocoderBing rgb = new ReverseGeocoderBing(); //        String result1 = rgb.reverse(edge); //         //        StringTokenizer st = new StringTokenizer(result1, "$$$"); //        String parts[] = result1.split("$$$"); //        String a = st.nextToken(); //        String b = st.nextToken(); //        System.out.println(a); //        System.out.println(b); //         //        String result = ""; //        Functions f=new Functions(); //        if(Integer.parseInt(item)==0){ //            result = f.getMean(edge); //        } //        if(Integer.parseInt(item)==1){ //            result = f.getMedian(edge); //        } //        if(Integer.parseInt(item)==2){ //            result = f.getVariance(edge); //        } //        if(Integer.parseInt(item)==3){ //            result = f.getSD(edge); //        } //        if(Integer.parseInt(item)==4){ //            result = f.getMeanDay(edge, date); //        } //        if(Integer.parseInt(item)==5){ //            result = f.getMedianDay(edge, date); //        } //        if(Integer.parseInt(item)==6){ //            result = f.getVarianceDay(edge, date); //        } //        if(Integer.parseInt(item)==7){ //            result = f.getSDDay(edge, date); //        } //        if(Integer.parseInt(item)==8){ //            result = f.getMeanTime(edge, time); //        } //        if(Integer.parseInt(item)==9){ //            result = f.getMedianTime(edge, time); //        } //        if(Integer.parseInt(item)==10){ //            result = f.getVarianceTime(edge, time); //        } //        if(Integer.parseInt(item)==11){ //            result = f.getSDTime(edge, time); //        } //        if(Integer.parseInt(item)==12){ //            result = f.getState(edge, date, time); //        } //System.out.println(result);