Menu

#17 GeometryGraph.insertBoundaryPoint NULL label check

closed-fixed
nobody
None
5
2011-07-06
2011-07-04
No

GeometryGraph#insertBoundaryPoint checks the node label for being null only once, but uses it twice:

private void insertBoundaryPoint(int argIndex, Coordinate coord)
{
Node n = nodes.addNode(coord);
Label lbl = n.getLabel();
// the new point to insert is on a boundary
int boundaryCount = 1;
// determine the current location for the point (if any)
int loc = Location.NONE;
if (lbl != null) loc = lbl.getLocation(argIndex, Position.ON);
if (loc == Location.BOUNDARY) boundaryCount++;

// determine the boundary status of the point according to the Boundary Determination Rule
int newLoc = determineBoundary(boundaryNodeRule, boundaryCount);
lbl.setLocation(argIndex, newLoc);
}

Discussion

  • Dr JTS

    Dr JTS - 2011-07-06
    • status: open --> closed-fixed
     
  • Dr JTS

    Dr JTS - 2011-07-06

    Nodes always have labels, so null check is not required. Removed

     

Log in to post a comment.