Constructor and Description |
---|
Pattern(Segment... segments)
Initializes the pattern with the given segments.
|
Modifier and Type | Method and Description |
---|---|
Version |
getFirstVersion()
Builds and returns the first version specified by this pattern.
|
Segment |
getPart(int index)
Returns segment at the given index (from the most significant one on the left).
|
Version |
getVersion(String versionId)
Parses the given version ID.
|
String |
toString() |
public Pattern(@NotNull Segment... segments)
The given segments should be ordered from the most significant to the least significant (left to right). Please make sure that no segments are overlapping. There are 2 common solutions to that:
'.'
) and create a static segment with it.
Define the pattern so each segment is differentiated from another with this static segment and make sure no
segment contains the reserved character in any of its elements. This way you can prevent overlapping and
simultaneously keep standard version specification (e.g. 1.2
). Same applies if you would like to
use character sequence instead of only one character.For more information please visit the wiki.
segments
- the segments, ordered from left (most-significant) to right (least-significant)@NotNull public Segment getPart(int index)
index
- the index@Nullable public Version getVersion(@NotNull String versionId)
null
.versionId
- the version IDpublic Version getFirstVersion()
More formally, returns version represented by all cursors set to the lowest index - 0
.
Copyright © 2022. All rights reserved.