Record Class DiffLine
java.lang.Object
java.lang.Record
cloud.opencode.base.string.diff.DiffLine
public record DiffLine(DiffLine.Type type, int originalLine, int revisedLine, String content)
extends Record
Diff Line - Record representing a single line in a diff result.
差异行 - 表示差异结果中单行的记录。
Features | 主要功能:
- Diff type (EQUAL, INSERT, DELETE, MODIFY) - 差异类型
- Line number tracking for original and revised - 原始和修改行号跟踪
Usage Examples | 使用示例:
DiffLine line = new DiffLine(DiffLine.Type.INSERT, -1, 5, "new content");
DiffLine.Type type = line.type(); // INSERT
Security | 安全性:
- Thread-safe: Yes (record is immutable) - 线程安全: 是(记录不可变)
- Since:
- JDK 25, opencode-base-string V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionDiffLine(DiffLine.Type type, int originalLine, int revisedLine, String content) Creates an instance of aDiffLinerecord class. -
Method Summary
Modifier and TypeMethodDescriptioncontent()Returns the value of thecontentrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of theoriginalLinerecord component.intReturns the value of therevisedLinerecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.
-
Constructor Details
-
DiffLine
Creates an instance of aDiffLinerecord class.- Parameters:
type- the value for thetyperecord componentoriginalLine- the value for theoriginalLinerecord componentrevisedLine- the value for therevisedLinerecord componentcontent- the value for thecontentrecord component
-
-
Method Details
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
originalLine
public int originalLine()Returns the value of theoriginalLinerecord component.- Returns:
- the value of the
originalLinerecord component
-
revisedLine
public int revisedLine()Returns the value of therevisedLinerecord component.- Returns:
- the value of the
revisedLinerecord component
-
content
Returns the value of thecontentrecord component.- Returns:
- the value of the
contentrecord component
-