Exemplo n.º 1
0
  public ROADUpdateTurnAround(
      String networkFn, String hierFn, String msgFn, String queryFn, String updateFn)
      throws IOException {
    GraphPool.loadGraph(networkFn);
    RNetHierarchy.loadHierarchy(hierFn);
    MsgObjPool.loadMsgPool(msgFn);

    String fn = queryFn + ".loc.txt";
    BufferedWriter writer = new BufferedWriter(new FileWriter(new File(fn)));
    writer.write("x,y" + "\n");

    queryList = new ArrayList<Integer>();
    BufferedReader in = new BufferedReader(new FileReader(queryFn));
    String str;
    while ((str = in.readLine()) != null) {
      Integer vID = Integer.valueOf(str);
      queryList.add(vID);
      Vertex v = GraphPool.getSignleton().getVertex(vID);
      double[] xy = v.getloc().m_pCoords;
      writer.write(String.valueOf(xy[0]));
      writer.write(",");
      writer.write(String.valueOf(xy[1]));
      writer.write("\n");
    }
    in.close();
    writer.close();

    insertList = new ArrayList<Integer>();
    in = new BufferedReader(new FileReader(updateFn));
    while ((str = in.readLine()) != null) {
      Integer vID = Integer.valueOf(str);
      insertList.add(vID);
    }
    in.close();
  }
Exemplo n.º 2
0
  private void insertObject(int vID) {
    // TODO Auto-generated method stub
    Vertex v = GraphPool.getSignleton().getVertex(vID);

    int msgSize = MsgObjPool.getSignleton().getMsgSize();

    MsgObj obj = new MsgObj(msgSize, v.getloc().getCoord(0), v.getloc().getCoord(1));
    obj.setAssocVertex(vID);
    MsgObjPool.getSignleton().insertMsg(obj);
    v.insertAssocMsgObj(msgSize);

    int maxLevel = RNetHierarchy.getSignleton().getMaxLevel();
    for (int i = 0; i <= maxLevel; i++) {
      int rID = v.getInsideRNetID(i);
      RNet rnet = RNetHierarchy.getSignleton().getRNet(rID);
      // rnet.setContainObj(true);
      rnet.increaseObjCnt(1);
    }
  }