code: private static void add(LineString line, int flag, ArrayList<SegmentString> segments) {
          SegmentString ss = new NodedSegmentString(line.getCoordinates(),
                  flag);
          segments.add(ss);
      }
docs: Convert a linestring as a list of segments and mark it with a flag
  @param line
  @param flag
  @param segments