Package org.eclipse.jgit.diff
Class Subsequence<S extends Sequence>
 java.lang.Object

 org.eclipse.jgit.diff.Sequence

 org.eclipse.jgit.diff.Subsequence<S>

 Type Parameters:
S
 the base sequence type.
public final class Subsequence<S extends Sequence> extends Sequence
Wraps aSequence
to have a narrower range of elements.This sequence acts as a proxy for the real sequence, translating element indexes on the fly by adding
begin
to them. Sequences of this type must be used with aSubsequenceComparator
.


Constructor Summary
Constructors Constructor Description Subsequence(S base, int begin, int end)
Construct a subset of another sequence.

Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <S extends Sequence>
Subsequence<S>a(S a, Edit region)
Construct a subsequence around the A region/base sequence.static <S extends Sequence>
Subsequence<S>b(S b, Edit region)
Construct a subsequence around the B region/base sequence.int
size()
Get sizestatic <S extends Sequence>
EditListtoBase(EditList edits, Subsequence<S> a, Subsequence<S> b)
Adjust the Edits to reflect positions in the base sequence.static <S extends Sequence>
voidtoBase(Edit e, Subsequence<S> a, Subsequence<S> b)
Adjust the Edit to reflect positions in the base sequence.



Constructor Detail

Subsequence
public Subsequence(S base, int begin, int end)
Construct a subset of another sequence. The size of the subsequence will beend  begin
. Parameters:
base
 the real sequence.begin
 First element index ofbase
that will be part of this new subsequence. The element atbegin
will be this sequence's element 0.end
 One past the last element index ofbase
that will be part of this new subsequence.


Method Detail

a
public static <S extends Sequence> Subsequence<S> a(S a, Edit region)
Construct a subsequence around the A region/base sequence. Parameters:
a
 the A sequence.region
 the region ofa
to create a subsequence around. Returns:
 subsequence of
base
as described by A inregion
.

b
public static <S extends Sequence> Subsequence<S> b(S b, Edit region)
Construct a subsequence around the B region/base sequence. Parameters:
b
 the B sequence.region
 the region ofb
to create a subsequence around. Returns:
 subsequence of
base
as described by B inregion
.

toBase
public static <S extends Sequence> void toBase(Edit e, Subsequence<S> a, Subsequence<S> b)
Adjust the Edit to reflect positions in the base sequence. Parameters:
e
 edit to adjust inplace. Prior to invocation the indexes are in terms of the two subsequences; after invocation the indexes are in terms of the base sequences.a
 the A sequence.b
 the B sequence.

toBase
public static <S extends Sequence> EditList toBase(EditList edits, Subsequence<S> a, Subsequence<S> b)
Adjust the Edits to reflect positions in the base sequence. Parameters:
edits
 edits to adjust inplace. Prior to invocation the indexes are in terms of the two subsequences; after invocation the indexes are in terms of the base sequences.a
 the A sequence.b
 the B sequence. Returns:
 always
edits
(as the list was updated inplace).

