code: private static void add(Polygon poly, int flag, ArrayList<SegmentString> segments) {
          add(poly.getExteriorRing(), flag, segments);
          for (int j = 0; j < poly.getNumInteriorRing(); j++) {
              add(poly.getInteriorRingN(j), flag, segments);
          }
      }
docs: Convert a polygon as a list of segments and mark it with a flag
  @param poly
  @param flag
  @param segments