
com.undefinedlabs.scope.utils.sourcecode.SourceCodeBoundary Maven / Gradle / Ivy
package com.undefinedlabs.scope.utils.sourcecode;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
public class SourceCodeBoundary {
public static final SourceCodeBoundary EMPTY =
new SourceCodeBoundary(SourceCode.EMPTY, -1, -1, -1);
private final SourceCode boundarySourceCode;
private final int boundaryMethodLine;
private final int instructionStartLine;
private final int instructionEndLine;
public SourceCodeBoundary(
final SourceCode boundarySourceCode,
final int boundaryMethodLine,
final int instructionStartLine,
final int instructionEndLine) {
this.boundarySourceCode = boundarySourceCode;
this.boundaryMethodLine = boundaryMethodLine;
this.instructionStartLine = instructionStartLine;
this.instructionEndLine = instructionEndLine;
}
public SourceCode getBoundarySourceCode() {
return boundarySourceCode;
}
public int getBoundaryMethodLine() {
return boundaryMethodLine;
}
public int getInstructionStartLine() {
return instructionStartLine;
}
public int getInstructionEndLine() {
return instructionEndLine;
}
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final SourceCodeBoundary that = (SourceCodeBoundary) o;
return new EqualsBuilder()
.append(boundaryMethodLine, that.boundaryMethodLine)
.append(instructionStartLine, that.instructionStartLine)
.append(instructionEndLine, that.instructionEndLine)
.append(boundarySourceCode, that.boundarySourceCode)
.isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
.append(boundarySourceCode)
.append(boundaryMethodLine)
.append(instructionStartLine)
.append(instructionEndLine)
.toHashCode();
}
@Override
public String toString() {
return new ToStringBuilder(this)
.append("boundarySourceCode", boundarySourceCode)
.append("boundaryMethodLine", boundaryMethodLine)
.append("instructionStartLine", instructionStartLine)
.append("instructionEndLine", instructionEndLine)
.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy