public void write(LineMap lineMap)
    throws IOException
  {
    _os.println("SMAP");
    _os.println(lineMap.getDestFilename());
    _os.println(_sourceType);
    _os.println("*S " + _sourceType);

    IntMap fileMap = new IntMap();

    _os.println("*F");
    Iterator<LineMap.Line> iter = lineMap.iterator();
    while (iter.hasNext()) {
      LineMap.Line line = iter.next();

      String filename = line.getSourceFilename();
      int index = fileMap.get(filename);
      if (index < 0) {
        index = fileMap.size() + 1;
        fileMap.put(filename, index);

        if (filename.indexOf('/') >= 0) {
          int p = filename.lastIndexOf('/');

          _os.println("+ " + index + " " + filename.substring(p + 1));
          // XXX: _os.println(filename);

          if (filename.startsWith("/"))
            _os.println(filename.substring(1));
          else
            _os.println(filename);
        }
        else
          _os.println(index + " " + filename);
      }
    }
    
    _os.println("*L");
    int size = lineMap.size();
    int lastIndex = 0;
    for (int i = 0; i < size; i++) {
      LineMap.Line line = lineMap.get(i);

      String filename = line.getSourceFilename();
      int index = fileMap.get(filename);

      String fileMarker = "";

      _os.print(line.getSourceLine());
      _os.print("#" + index);

      if (line.getRepeatCount() > 1)
        _os.print("," + line.getRepeatCount());

      _os.print(":");
      _os.print(line.getDestinationLine());
      if (line.getDestinationIncrement() > 1)
        _os.print("," + line.getDestinationIncrement());
      _os.println();
    }
    
    _os.println("*E");
  }
public void write ( LineMap lineMap ) throws IOException { _os . println ( "SMAP" ) ; _os . println ( lineMap . getDestFilename ( ) ) ; _os . println ( _sourceType ) ; _os . println ( "*S " + _sourceType ) ; IntMap fileMap = new IntMap ( ) ; _os . println ( "*F" ) ; Iterator < LineMap . Line > iter = lineMap . iterator ( ) ; while ( iter . hasNext ( ) ) { LineMap . Line line = iter . next ( ) ; String filename = line . getSourceFilename ( ) ; int index = fileMap . get ( filename ) ; if ( index < 0 ) { index = fileMap . size ( ) + 1 ; fileMap . put ( filename , index ) ; if ( filename . indexOf ( '/' ) >= 0 ) { int p = filename . lastIndexOf ( '/' ) ; _os . println ( "+ " + index + " " + filename . substring ( p + 1 ) ) ; if ( filename . startsWith ( "/" ) ) _os . println ( filename . substring ( 1 ) ) ; else _os . println ( filename ) ; } else _os . println ( index + " " + filename ) ; } } _os . println ( "*L" ) ; int size = lineMap . size ( ) ; int lastIndex = 0 ; for ( int i = 0 ; i < size ; i ++ ) { LineMap . Line line = lineMap . get ( i ) ; String filename = line . getSourceFilename ( ) ; int index = fileMap . get ( filename ) ; String fileMarker = "" ; _os . print ( line . getSourceLine ( ) ) ; _os . print ( "#" + index ) ; if ( line . getRepeatCount ( ) > 1 ) _os . print ( "," + line . getRepeatCount ( ) ) ; _os . print ( ":" ) ; _os . print ( line . getDestinationLine ( ) ) ; if ( line . getDestinationIncrement ( ) > 1 ) _os . print ( "," + line . getDestinationIncrement ( ) ) ; _os . println ( ) ; } _os . println ( "*E" ) ; }
Writes the line map