Example #1
0
 private void checkNodes() {
   DataSet dataSet = getDataSet();
   if (dataSet != null) {
     Node[] nodes = this.nodes;
     for (Node n : nodes) {
       if (n.getDataSet() != dataSet)
         throw new DataIntegrityProblemException(
             "Nodes in way must be in the same dataset",
             tr("Nodes in way must be in the same dataset"));
       if (n.isDeleted())
         throw new DataIntegrityProblemException(
             "Deleted node referenced: " + toString(),
             "<html>"
                 + tr(
                     "Deleted node referenced by {0}",
                     DefaultNameFormatter.getInstance().formatAsHtmlUnorderedList(this))
                 + "</html>");
     }
     if (Main.pref.getBoolean("debug.checkNullCoor", true)) {
       for (Node n : nodes) {
         if (n.isVisible() && !n.isIncomplete() && !n.isLatLonKnown())
           throw new DataIntegrityProblemException(
               "Complete visible node with null coordinates: " + toString(),
               "<html>"
                   + tr(
                       "Complete node {0} with null coordinates in way {1}",
                       DefaultNameFormatter.getInstance().formatAsHtmlUnorderedList(n),
                       DefaultNameFormatter.getInstance().formatAsHtmlUnorderedList(this))
                   + "</html>");
       }
     }
   }
 }
  /**
   * My and their node are new but semantically equal. Both are deleted.
   *
   * <p>=> take mine
   */
  @Test
  public void nodeSimple_DeleteConflict_4() {
    Node n = new Node(new LatLon(1, 1));
    n.setDeleted(true);
    my.addPrimitive(n);

    Node n1 = new Node(new LatLon(1, 1));
    n1.setDeleted(true);
    their.addPrimitive(n1);

    DataSetMerger visitor = new DataSetMerger(my, their);
    visitor.merge();

    assertEquals(0, visitor.getConflicts().size());
    Node n2 = (Node) my.getNodes().toArray()[0];
    assertSame(n2, n);
    assertTrue(n2.isDeleted());
  }
Example #3
0
  public static void propagateKill(Node node) {
    if (node != null && node.isAlive()) {
      List<Node> usagesSnapshot = node.usages().filter(isFloatingNode()).snapshot();

      // null out remaining usages
      node.replaceAtUsages(null);
      node.replaceAtPredecessor(null);
      killWithUnusedFloatingInputs(node);

      for (Node usage : usagesSnapshot) {
        if (!usage.isDeleted()) {
          if (usage instanceof PhiNode) {
            usage.replaceFirstInput(node, null);
          } else {
            propagateKill(usage);
          }
        }
      }
    }
  }