Пример #1
0
  public void cutBlastFenceModel(BlastFenceModel blastFenceModel, int vertex) {
    BlastFenceModel model2 = (BlastFenceModel) blastFenceModel.clone();
    for (int i = 0; i <= vertex; i++)
      model2.removeVertexModel((VertexModel) model2.getVertexAL().get(0));

    for (int i = blastFenceModel.getVertexAL().size() - 1; i > vertex; i--)
      blastFenceModel.removeVertexModel(
          (VertexModel) blastFenceModel.getVertexAL().get(vertex + 1));

    addBlastFenceModel(model2);
  }
Пример #2
0
  public void mergeBlastFences(
      BlastFenceModel model1,
      BlastFenceModel model2,
      VertexModel vertexModel1,
      VertexModel vertexModel2) {
    boolean insert = model1.getVertexAL().get(0) == vertexModel1;
    ArrayList arrayList = model2.getVertexAL();
    if (vertexModel2 == arrayList.get(0)) {
      for (int i = 1; i < arrayList.size(); i++)
        if (insert)
          model1.insertVertexModel((VertexModel) ((VertexModel) arrayList.get(i)).clone(), 0);
        else model1.addVertexModel((VertexModel) ((VertexModel) arrayList.get(i)).clone());

    } else {
      for (int i = arrayList.size() - 2; i >= 0; i--)
        if (insert)
          model1.insertVertexModel((VertexModel) ((VertexModel) arrayList.get(i)).clone(), 0);
        else model1.addVertexModel((VertexModel) ((VertexModel) arrayList.get(i)).clone());
    }
    removeBlastFenceModel(model2);
  }