001package org.conqat.engine.commons.findings.location;
002
003import java.util.Set;
004
005import org.conqat.lib.commons.region.LineBasedRegion;
006
007/** Adjustes the location of a single line. */
008public interface ILineAdjuster {
009
010        /**
011         * Adjusts the location of a single line. This only respects the token part of a
012         * line, i.e. leading and trailing whitespace of a line will be ignored. This
013         * method is robust w.r.t lines numbers that are out of the range of the
014         * original text. In case of such an invalid line, the line is logged as error
015         * to the given logger and <code>null</code> is returned.
016         *
017         * @param line
018         *            the one-based line number of be adjusted.
019         * @param invalidLines
020         *            used for collecting invalid lines.
021         *
022         * @return the one-based lines encoded as a region, as a line may map to
023         *         multiple lines after changing. This may also return null, if no
024         *         non-empty lines could be found that correspond to the input line
025         *         after adjustment.
026         */
027        LineBasedRegion adjustLine(int line, Set<Integer> invalidLines);
028
029        /** Returns the line count of the original text */
030        int getOriginalLineCount();
031}