// Path: sbt-compiler-api/src/main/java/com/google/code/sbt/compiler/api/SourcePosition.java
// public interface SourcePosition
// {
// 
//     /**
//      * One-based line number or value less than one if line number not specified.
//      *
//      * @return line number
//      */
//     int getLine();
// 
//     /**
//      * Line content or empty string if line number not specified.
//      *
//      * @return line content
//      */
//     String getLineContent();
// 
//     /**
//      * Zero-based offset in characters from the beginning of the file or value less than zero if not specified.
//      *
//      * @return file offset
//      */
//     int getOffset();
// 
//     /**
//      * One-based position in the line or value less than one if position not specified.
//      *
//      * @return position in the line
//      */
//     int getPointer();
// 
//     /**
//      * File.
//      *
//      * @return file
//      */
//     File getFile();
// 
// }
// 
// Path: sbt-compiler-api/src/main/java/com/google/code/sbt/compiler/api/SourcePositionMapper.java
// public interface SourcePositionMapper
// {
// 
//     /**
//      * Sets source files character set name (encoding).
//      * 
//      * @param charsetName source files character set name
//      */
//     void setCharsetName( String charsetName );
// 
//     /**
//      * Performs mapping from the position in generated source file to the position in original source file it was
//      * generated from.<br>
//      * <br>
//      * Returns:
//      * <ul>
//      * <li>position in original source file</li>
//      * <li>
//      * {@code null} value if file of the input position is not recognized as generated file supported by this
//      * mapper.</li>
//      * </ul>
//      *
//      * @param p compilation error/warning position in generated file
//      * @return position in original source file or {@code null} value if file of the input position is not recognized as
//      *         generated file supported by this mapper
//      * @throws IOException I/O exception during generated or original source file reading
//      */
//     SourcePosition map( SourcePosition p ) throws IOException;
// 
// }


import java.io.IOException;
import java.util.Collection;
import com.google.code.sbt.compiler.api.SourcePosition;
import com.google.code.sbt.compiler.api.SourcePositionMapper;
/*
 * Copyright 2013-2017 Grzegorz Slowikowski (gslowikowski at gmail dot com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package com.google.code.sbt.compiler.plugin;



/**
 * Wwrapper for a collection of source position mappers.<br>
 * <br>
 * When mapping the position it iterates over contained mappers until one of them returns
 * not {@code null} result.
 *
 * @author <a href="mailto:gslowikowski@gmail.com">Grzegorz Slowikowski</a>
 */
public class SourcePositionMapperCollection
    implements SourcePositionMapper
{

    private Collection<SourcePositionMapper> mappers;

    /**
     * Creates source position mappers collection.
     * 
     * @param mappers source position mappers
     */
    public SourcePositionMapperCollection( Collection<SourcePositionMapper> mappers )
    {
        this.mappers = mappers;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void setCharsetName( String charsetName )
    {
        for ( SourcePositionMapper mapper: mappers )
        {
            mapper.setCharsetName( charsetName );
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
// Path: sbt-compiler-api/src/main/java/com/google/code/sbt/compiler/api/SourcePosition.java
// public interface SourcePosition
// {
// 
//     /**
//      * One-based line number or value less than one if line number not specified.
//      *
//      * @return line number
//      */
//     int getLine();
// 
//     /**
//      * Line content or empty string if line number not specified.
//      *
//      * @return line content
//      */
//     String getLineContent();
// 
//     /**
//      * Zero-based offset in characters from the beginning of the file or value less than zero if not specified.
//      *
//      * @return file offset
//      */
//     int getOffset();
// 
//     /**
//      * One-based position in the line or value less than one if position not specified.
//      *
//      * @return position in the line
//      */
//     int getPointer();
// 
//     /**
//      * File.
//      *
//      * @return file
//      */
//     File getFile();
// 
// }
// 
// Path: sbt-compiler-api/src/main/java/com/google/code/sbt/compiler/api/SourcePositionMapper.java
// public interface SourcePositionMapper
// {
// 
//     /**
//      * Sets source files character set name (encoding).
//      * 
//      * @param charsetName source files character set name
//      */
//     void setCharsetName( String charsetName );
// 
//     /**
//      * Performs mapping from the position in generated source file to the position in original source file it was
//      * generated from.<br>
//      * <br>
//      * Returns:
//      * <ul>
//      * <li>position in original source file</li>
//      * <li>
//      * {@code null} value if file of the input position is not recognized as generated file supported by this
//      * mapper.</li>
//      * </ul>
//      *
//      * @param p compilation error/warning position in generated file
//      * @return position in original source file or {@code null} value if file of the input position is not recognized as
//      *         generated file supported by this mapper
//      * @throws IOException I/O exception during generated or original source file reading
//      */
//     SourcePosition map( SourcePosition p ) throws IOException;
// 
// }


// Path: sbt-compiler-maven-plugin/src/main/java/com/google/code/sbt/compiler/plugin/SourcePositionMapperCollection.java
import java.io.IOException;
import java.util.Collection;
import com.google.code.sbt.compiler.api.SourcePosition;
import com.google.code.sbt.compiler.api.SourcePositionMapper;

/*
 * Copyright 2013-2017 Grzegorz Slowikowski (gslowikowski at gmail dot com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package com.google.code.sbt.compiler.plugin;



/**
 * Wwrapper for a collection of source position mappers.<br>
 * <br>
 * When mapping the position it iterates over contained mappers until one of them returns
 * not {@code null} result.
 *
 * @author <a href="mailto:gslowikowski@gmail.com">Grzegorz Slowikowski</a>
 */
public class SourcePositionMapperCollection
    implements SourcePositionMapper
{

    private Collection<SourcePositionMapper> mappers;

    /**
     * Creates source position mappers collection.
     * 
     * @param mappers source position mappers
     */
    public SourcePositionMapperCollection( Collection<SourcePositionMapper> mappers )
    {
        this.mappers = mappers;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void setCharsetName( String charsetName )
    {
        for ( SourcePositionMapper mapper: mappers )
        {
            mapper.setCharsetName( charsetName );
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public SourcePosition map( SourcePosition sp ) throws IOException