示例#1
0
  private void computeNodedEdges(List bufferSegStrList, PrecisionModel precisionModel) {
    Noder noder = getNoder(precisionModel);
    noder.computeNodes(bufferSegStrList);
    Collection nodedSegStrings = noder.getNodedSubstrings();
    // DEBUGGING ONLY
    // BufferDebug.saveEdges(nodedEdges, "run" + BufferDebug.runCount + "_nodedEdges");

    for (Iterator i = nodedSegStrings.iterator(); i.hasNext(); ) {
      SegmentString segStr = (SegmentString) i.next();
      Label oldLabel = (Label) segStr.getData();
      Edge edge = new Edge(segStr.getCoordinates(), new Label(oldLabel));
      insertUniqueEdge(edge);
    }
    // saveEdges(edgeList.getEdges(), "run" + runCount + "_collapsedEdges");
  }
 /** @param level -1 to get items */
 private void boundablesAtLevel(int level, AbstractNode top, Collection boundables) {
   Assert.isTrue(level > -2);
   if (top.getLevel() == level) {
     boundables.add(top);
     return;
   }
   for (Iterator i = top.getChildBoundables().iterator(); i.hasNext(); ) {
     Boundable boundable = (Boundable) i.next();
     if (boundable instanceof AbstractNode) {
       boundablesAtLevel(level, (AbstractNode) boundable, boundables);
     } else {
       Assert.isTrue(boundable instanceof ItemBoundable);
       if (level == -1) {
         boundables.add(boundable);
       }
     }
   }
   return;
 }