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

public final Class SubsequenceComparator<S extends Sequence>

extends SequenceComparator<Subsequence<S extends Sequence>>
Class Inheritance
Type Parameters
<S>
the base sequence type.

Wrap another comparator for use with org.eclipse.jgit.diff.Subsequence.

This comparator acts as a proxy for the real comparator, translating element indexes on the fly by adding the subsequence's begin offset to them. Comparators of this type must be used with a org.eclipse.jgit.diff.Subsequence.

Field Summary

Modifier and TypeField and Description
private final SequenceComparator<? super S>

Constructor Summary

AccessConstructor and Description
public
SubsequenceComparator(SequenceComparator<? super S>
the real comparator.
cmp
)

Construct a comparator wrapping another comparator.

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Subsequence<S>
the first sequence.
a
,
int
item of ai to compare.
ai
,
Subsequence<S>
the second sequence.
b
,
int
item of bi to compare.
bi
)

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

Compare two items to determine if they are equivalent.

public int
hash(Subsequence<S>
the sequence.
seq
,
int
the item to obtain the hash for.
ptr
)

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

Get a hash value for an item in a sequence.

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

Field Detail

cmpback to summary
private final SequenceComparator<? super S> cmp

Constructor Detail

SubsequenceComparatorback to summary
public SubsequenceComparator(SequenceComparator<? super S> cmp)

Construct a comparator wrapping another comparator.

Parameters
cmp:SequenceComparator<? super S>

the real comparator.

Method Detail

equalsback to summary
public boolean equals(Subsequence<S> a, int ai, Subsequence<S> b, int bi)

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

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

Compare two items to determine if they are equivalent. It is permissible to compare sequence a with itself (by passing a again in position b).

Parameters
a:Subsequence<S>

the first sequence.

ai:int

item of ai to compare.

b:Subsequence<S>

the second sequence.

bi:int

item of bi to compare.

Returns:boolean

true if the two items are identical according to this function's equivalence rule.

Annotations
@Override
hashback to summary
public int hash(Subsequence<S> seq, int ptr)

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:Subsequence<S>

the sequence.

ptr:int

the item to obtain the hash for.

Returns:int

hash the hash value.

Annotations
@Override