org.conqat.engine.commons.findings.location.ILineAdjuster Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of teamscale-commons Show documentation
Show all versions of teamscale-commons Show documentation
Provides common DTOs for Teamscale
/*
* Copyright (c) CQSE GmbH
*
* 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 org.conqat.engine.commons.findings.location;
import java.util.Set;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.conqat.lib.commons.region.LineBasedRegion;
/** Adjustes the location of a single line. */
public interface ILineAdjuster {
/**
* Adjusts the location of a single line. This only respects the token part of a
* line, i.e. leading and trailing whitespace of a line will be ignored. This
* method is robust w.r.t lines numbers that are out of the range of the
* original text. In case of such an invalid line, the line is logged as error
* to the given logger and null
is returned.
*
* @param line
* the one-based line number of be adjusted.
* @param invalidLines
* used for collecting invalid lines.
*
* @return the one-based lines encoded as a region, as a line may map to
* multiple lines after changing. This may also return null, if no
* non-empty lines could be found that correspond to the input line
* after adjustment.
*/
@Nullable
LineBasedRegion adjustLine(int line, Set invalidLines);
/** Returns the line count of the original text */
int getOriginalLineCount();
/**
* Returns a new location with adjusted offsets (if necessary). Returns
* {@code null} if the location cannot be mapped to the adjusted text.
*/
@Nullable
ElementLocation adjustLocation(ElementLocation location);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy