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

public final Class HashedSequenceComparator<S extends Sequence>

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

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

This comparator acts as a proxy for the real comparator, evaluating the cached hash code before testing the underlying comparator's equality. Comparators of this type must be used with a org.eclipse.jgit.diff.HashedSequence.

To construct an instance of this type use org.eclipse.jgit.diff.HashedSequencePair.

Field Summary

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

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(HashedSequence<S>
the first sequence.
a
,
int
item of ai to compare.
ai
,
HashedSequence<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(HashedSequence<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

HashedSequenceComparatorback to summary
pack-priv HashedSequenceComparator(SequenceComparator<? super S> cmp)

Method Detail

equalsback to summary
public boolean equals(HashedSequence<S> a, int ai, HashedSequence<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:HashedSequence<S>

the first sequence.

ai:int

item of ai to compare.

b:HashedSequence<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(HashedSequence<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:HashedSequence<S>

the sequence.

ptr:int

the item to obtain the hash for.

Returns:int

hash the hash value.

Annotations
@Override