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

public final Class Subsequence<S extends Sequence>

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

Wraps a org.eclipse.jgit.diff.Sequence 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 a org.eclipse.jgit.diff.SubsequenceComparator.

Field Summary

Modifier and TypeField and Description
pack-priv final S
pack-priv final int
private final int

Constructor Summary

AccessConstructor and Description
public
Subsequence(S
the real sequence.
base
,
int
First element index of base that will be part of this new subsequence. The element at begin will be this sequence's element 0.
begin
,
int
One past the last element index of base that will be part of this new subsequence.
end
)

Construct a subset of another sequence.

Method Summary

Modifier and TypeMethod and Description
public static <
type of returned Sequence
S extends Sequence
>
Subsequence<S>

Returns:

subsequence of base as described by A in region.
a
(S
the A sequence.
a
,
Edit
the region of a to create a subsequence around.
region
)

Construct a subsequence around the A region/base sequence.

public static <
type of returned Sequence
S extends Sequence
>
Subsequence<S>

Returns:

subsequence of base as described by B in region.
b
(S
the B sequence.
b
,
Edit
the region of b to create a subsequence around.
region
)

Construct a subsequence around the B region/base sequence.

public int
size()

Implements abstract org.eclipse.jgit.diff.Sequence.size.

Get size

public static <
type of returned Sequence
S extends Sequence
>
void
toBase(Edit
edit to adjust in-place. Prior to invocation the indexes are in terms of the two subsequences; after invocation the indexes are in terms of the base sequences.
e
,
Subsequence<S>
the A sequence.
a
,
Subsequence<S>
the B sequence.
b
)

Adjust the Edit to reflect positions in the base sequence.

public static <
type of returned Sequence
S extends Sequence
>
EditList

Returns:

always edits (as the list was updated in-place).
toBase
(EditList
edits to adjust in-place. Prior to invocation the indexes are in terms of the two subsequences; after invocation the indexes are in terms of the base sequences.
edits
,
Subsequence<S>
the A sequence.
a
,
Subsequence<S>
the B sequence.
b
)

Adjust the Edits to reflect positions in the base sequence.

Field Detail

baseback to summary
pack-priv final S base
beginback to summary
pack-priv final int begin
sizeback to summary
private final int size

Constructor Detail

Subsequenceback to summary
public Subsequence(S base, int begin, int end)

Construct a subset of another sequence. The size of the subsequence will be end - begin.

Parameters
base:S

the real sequence.

begin:int

First element index of base that will be part of this new subsequence. The element at begin will be this sequence's element 0.

end:int

One past the last element index of base that will be part of this new subsequence.

Method Detail

aback to summary
public static <S extends Sequence> Subsequence<S> a(S a, Edit region)

Construct a subsequence around the A region/base sequence.

Parameters
<S>
type of returned Sequence
a:S

the A sequence.

region:Edit

the region of a to create a subsequence around.

Returns:Subsequence<S>

subsequence of base as described by A in region.

bback to summary
public static <S extends Sequence> Subsequence<S> b(S b, Edit region)

Construct a subsequence around the B region/base sequence.

Parameters
<S>
type of returned Sequence
b:S

the B sequence.

region:Edit

the region of b to create a subsequence around.

Returns:Subsequence<S>

subsequence of base as described by B in region.

sizeback to summary
public int size()

Implements abstract org.eclipse.jgit.diff.Sequence.size.

Doc from org.eclipse.jgit.diff.Sequence.size.

Get size

Returns:int

size

Annotations
@Override
toBaseback to summary
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
<S>
type of returned Sequence
e:Edit

edit to adjust in-place. Prior to invocation the indexes are in terms of the two subsequences; after invocation the indexes are in terms of the base sequences.

a:Subsequence<S>

the A sequence.

b:Subsequence<S>

the B sequence.

toBaseback to summary
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
<S>
type of returned Sequence
edits:EditList

edits to adjust in-place. Prior to invocation the indexes are in terms of the two subsequences; after invocation the indexes are in terms of the base sequences.

a:Subsequence<S>

the A sequence.

b:Subsequence<S>

the B sequence.

Returns:EditList

always edits (as the list was updated in-place).