@Override public void visit(Mapping m,int line,int col,int nextLine,int nextCol) throws IOException {
  if (previousLine != line) {
    previousColumn=0;
  }
  if (line != nextLine || col != nextCol) {
    if (line < maxLine) {
      if (previousLine == line) {
        out.append(',');
      }
      writeEntry(m,col);
      previousLine=line;
      previousColumn=col;
    }
 else {
      Preconditions.checkState(m == null);
    }
  }
  for (int i=line; i <= nextLine && i < maxLine; i++) {
    if (i == nextLine) {
      break;
    }
    closeLine(false);
    openLine(false);
  }
}

@ Override public void visit ( Mapping m , int line , int col , int nextLine , int nextCol ) throws IOException { if ( previousLine != line ) { previousColumn = 0 ; } if ( line != nextLine || col != nextCol ) { if ( line < maxLine ) { if ( previousLine == line ) { out . append ( ',' ) ; } writeEntry ( m , col ) ; previousLine = line ; previousColumn = col ; } else { Preconditions . checkState ( m == null ) ; } } for ( int i = line ; i <= nextLine && i < maxLine ; i ++ ) { if ( i == nextLine ) { break ; } closeLine ( false ) ; openLine ( false ) ; } }
as each segment is visited write out the appropriate line mapping .
