| Constructor and Description |
|---|
LiteralSegment(String... elements)
Creates a segment with the given elements.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getElement(int index)
Returns i-th element in the segment's definition (1st element being represented by
0). |
int |
getElementLength(int index)
Returns length (in characters) of the i-th element in the segment's definition (1st element being represented by
0). |
int |
length()
The length of the segment - amount of elements in the segment's definition.
|
int |
parse(String versionId,
int index)
Parses the given version ID from the given index and returns which element (represented by the index) was
matched.
|
String |
toString() |
public LiteralSegment(String... elements)
elements - the elementspublic int parse(String versionId, int index)
Segment
For LiteralSegment, this is the first element to which String.startsWith(String) returns
true. For RangeSegment, this is the shortest sequence of characters at the start which
represent a number within this range.
If no element in the segment matches the start of the ID, returns -1. This might be the case if the
ID is malformed, or if the individual parts overlapping each other.
public String getElement(int index)
Segment0).
It must apply that 0 <= i < length(), otherwise, an IndexOutOfBoundsException will be
thrown.
getElement in interface Segmentindex - the indexpublic int getElementLength(int index)
Segment0).
It must apply that 0 <= i < length(), otherwise, an IndexOutOfBoundsException will be
thrown.
getElementLength in interface Segmentindex - the indexpublic int length()
SegmentCopyright © 2022. All rights reserved.