@Override public void SetBerthInfo(String pHtml) { BufferedReader buffer; try { StringReader sr = new StringReader(pHtml); buffer = new BufferedReader(sr); String line; int iStart = 0; while ((line = buffer.readLine()) != null) { if (line.contains(g_sBerth) || line.contains(g_sDepart) || line.contains(g_sPlan)) { if (iStart < 2) { buffer.readLine(); buffer.readLine(); } iStart++; if (iStart > 2) { System.out.print(getVVDStatus(line) + "*"); if (line.contains(g_sBerth)) { buffer.readLine(); buffer.readLine(); } if (line.contains(g_sDepart)) buffer.readLine(); buffer.readLine(); // Empty Space.. buffer.readLine(); // No. System.out.print(getVSLName(buffer.readLine()) + "*"); System.out.print(getVVD(buffer.readLine()) + "*"); String sINOUTVVD = buffer.readLine(); System.out.print(getINVVDforShippingCom(sINOUTVVD) + "*"); System.out.print(getOUTVVDforShippingCom(sINOUTVVD) + "*"); System.out.print(getOPR(buffer.readLine()) + "*"); System.out.print(getRoute(buffer.readLine()) + "*"); buffer.readLine(); // Berthing Direction System.out.print(getETB(buffer.readLine()) + "*"); System.out.print(getETD(buffer.readLine()) + "*"); System.out.print(getBerthNo(buffer.readLine()) + "*"); System.out.print(getCCT(buffer.readLine()) + "*"); System.out.print(getDISCnt(buffer.readLine()) + "*"); System.out.print(getLOADCnt(buffer.readLine()) + "*"); System.out.println(""); } } } } catch (Exception e) { Util.exceptionProc(e); } }
@Override public ArrayList<VesselSchedule> extractVesselSchedule(String html) { ArrayList<VesselSchedule> vesselScheduleList = new ArrayList<>(); BufferedReader buffer; try { StringReader sr = new StringReader(html); buffer = new BufferedReader(sr); String line; int iStart = 0; while ((line = buffer.readLine()) != null) { if (line.contains(g_sBerth) || line.contains(g_sDepart) || line.contains(g_sPlan)) { if (iStart < 2) { buffer.readLine(); buffer.readLine(); } iStart++; if (iStart > 2) { VesselSchedule vs = new VesselSchedule(); if (getVVDStatus(line).equals("Berth")) { vs.setVvdStatus(VVD_STATUS.BERTHING); } else if (getVVDStatus(line).equals("Depart")) { vs.setVvdStatus(VVD_STATUS.DEPARTED); } else if (getVVDStatus(line).equals("Plan")) { vs.setVvdStatus(VVD_STATUS.PLANNED); } else { vs.setVvdStatus(VVD_STATUS.UNKNOWN); } if (line.contains(g_sBerth)) { buffer.readLine(); buffer.readLine(); } if (line.contains(g_sDepart)) buffer.readLine(); buffer.readLine(); // Empty Space.. buffer.readLine(); // No. vs.setVslName(getVSLName(buffer.readLine())); vs.setVvd(getVVD(buffer.readLine())); String sINOUTVVD = buffer.readLine(); vs.setInVvdForShippingCom(getINVVDforShippingCom(sINOUTVVD)); vs.setOutVvdForShippingCom(getOUTVVDforShippingCom(sINOUTVVD)); vs.setOpr(getOPR(buffer.readLine())); vs.setRoute(getRoute(buffer.readLine())); buffer.readLine(); // Berthing Direction if (vs.getVvdStatus() == VVD_STATUS.PLANNED) { vs.setEtb(getETB(buffer.readLine())); } else if (vs.getVvdStatus() == VVD_STATUS.BERTHING || vs.getVvdStatus() == VVD_STATUS.DEPARTED) { vs.setAtb(getETB(buffer.readLine())); } else { vs.setEtb(getETB(buffer.readLine())); } if (vs.getVvdStatus() == VVD_STATUS.PLANNED || vs.getVvdStatus() == VVD_STATUS.BERTHING) { vs.setEtd(getETD(buffer.readLine())); } else if (vs.getVvdStatus() == VVD_STATUS.DEPARTED) { vs.setAtd(getETD(buffer.readLine())); } else { vs.setEtd(getETD(buffer.readLine())); } vs.setBerthNo(getBerthNo(buffer.readLine())); vs.setCct(getCCT(buffer.readLine())); vs.setDisCnt(Integer.parseInt(getDISCnt(buffer.readLine()).trim())); vs.setLoadCnt(Integer.parseInt(getLOADCnt(buffer.readLine()).trim())); vesselScheduleList.add(vs); } } } } catch (Exception e) { Util.exceptionProc(e); } return vesselScheduleList; }