| 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 (the first element having index
0). |
int |
getElementLength(int index)
Returns length (in characters) of the i-th element in the segment's definition (the first element having
index
0). |
int |
length()
Returns the length of the segment - amount of elements in the segment's definition.
|
int |
parse(String versionId,
int index)
Parses the given version ID, starting from the provided index and returns the index of element that 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 is matched, returns -1. This might be the case if the ID is malformed,
or if the individual segments overlap 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.