private void addLine(Coordinate[] pts) {
   SegmentString segStr = new BasicSegmentString(pts, null);
   List segChains = MonotoneChainBuilder.getChains(segStr.getCoordinates(), segStr);
   for (Iterator i = segChains.iterator(); i.hasNext(); ) {
     MonotoneChain mc = (MonotoneChain) i.next();
     index.insert(mc.getEnvelope(), mc);
   }
 }
 private void countSegs(
     RayCrossingCounter rcc, Envelope rayEnv, List monoChains, MCSegmentCounter mcSegCounter) {
   for (Iterator i = monoChains.iterator(); i.hasNext(); ) {
     MonotoneChain mc = (MonotoneChain) i.next();
     mc.select(rayEnv, mcSegCounter);
     // short-circuit if possible
     if (rcc.isOnSegment()) return;
   }
 }