Top Description Fields Constructors Methods
org.eclipse.jgit.diff

public abstract Class RawTextComparator

extends SequenceComparator<RawText>
Class Inheritance
Static Imports
org.eclipse.jgit.util.RawCharUtil.isWhitespace, .RawCharUtil.trimLeadingWhitespace, .RawCharUtil.trimTrailingWhitespace

Equivalence function for org.eclipse.jgit.diff.RawText.

Field Summary

Modifier and TypeField and Description
public static final RawTextComparator
DEFAULT

No special treatment.

public static final RawTextComparator
WS_IGNORE_ALL

Ignores all whitespace.

public static final RawTextComparator
WS_IGNORE_CHANGE

Ignores whitespace occurring between non-whitespace characters.

public static final RawTextComparator
WS_IGNORE_LEADING

Ignore leading whitespace.

public static final RawTextComparator
WS_IGNORE_TRAILING

Ignores trailing whitespace.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static int
findForwardLine(IntList lines, int idx, int ptr)

private static int
findReverseLine(IntList lines, int idx, int ptr)

public int
hash(RawText
the sequence.
seq
,
int
the item to obtain the hash for.
lno
)

Implements abstract org.eclipse.jgit.diff.SequenceComparator.hash.

Get a hash value for an item in a sequence.

protected abstract int

Returns:

hash code for the region [ptr, end) of raw.
hashRegion
(byte[]
the raw file content.
raw
,
int
first byte of the region to hash.
ptr
,
int
1 past the last byte of the region.
end
)

Compute a hash code for a region.

public Edit
reduceCommonStartEnd(RawText
the first sequence.
a
,
RawText
the second sequence.
b
,
Edit
the edit to start with and update.
e
)

Overrides org.eclipse.jgit.diff.SequenceComparator.reduceCommonStartEnd.

Modify the edit to remove common leading and trailing items.

Inherited from org.eclipse.jgit.diff.SequenceComparator:
equals

Field Detail

DEFAULTback to summary
public static final RawTextComparator DEFAULT

No special treatment.

WS_IGNORE_ALLback to summary
public static final RawTextComparator WS_IGNORE_ALL

Ignores all whitespace.

WS_IGNORE_CHANGEback to summary
public static final RawTextComparator WS_IGNORE_CHANGE

Ignores whitespace occurring between non-whitespace characters.

WS_IGNORE_LEADINGback to summary
public static final RawTextComparator WS_IGNORE_LEADING

Ignore leading whitespace.

WS_IGNORE_TRAILINGback to summary
public static final RawTextComparator WS_IGNORE_TRAILING

Ignores trailing whitespace.

Constructor Detail

RawTextComparatorback to summary
public RawTextComparator()

Method Detail

findForwardLineback to summary
private static int findForwardLine(IntList lines, int idx, int ptr)
findReverseLineback to summary
private static int findReverseLine(IntList lines, int idx, int ptr)
hashback to summary
public int hash(RawText seq, int lno)

Implements abstract org.eclipse.jgit.diff.SequenceComparator.hash.

Doc from org.eclipse.jgit.diff.SequenceComparator.hash.

Get a hash value for an item in a sequence. If two items are equal according to this comparator's equals(Sequence, int, Sequence, int) method, then this hash method must produce the same integer result for both items. It is not required for two items to have different hash values if they are unequal according to the equals() method.

Parameters
seq:RawText

the sequence.

lno:int

the item to obtain the hash for.

Returns:int

hash the hash value.

Annotations
@Override
hashRegionback to summary
protected abstract int hashRegion(byte[] raw, int ptr, int end)

Compute a hash code for a region.

Parameters
raw:byte[]

the raw file content.

ptr:int

first byte of the region to hash.

end:int

1 past the last byte of the region.

Returns:int

hash code for the region [ptr, end) of raw.

reduceCommonStartEndback to summary
public Edit reduceCommonStartEnd(RawText a, RawText b, Edit e)

Overrides org.eclipse.jgit.diff.SequenceComparator.reduceCommonStartEnd.

Doc from org.eclipse.jgit.diff.SequenceComparator.reduceCommonStartEnd.

Modify the edit to remove common leading and trailing items. The supplied edit e is reduced in size by moving the beginning A and B points so the edit does not cover any items that are in common between the two sequences. The ending A and B points are also shifted to remove common items from the end of the region.

Parameters
a:RawText

the first sequence.

b:RawText

the second sequence.

e:Edit

the edit to start with and update.

Returns:Edit

e if it was updated in-place, otherwise a new edit containing the reduced region.

Annotations
@Override