public class Pattern extends Object
| Constructor and Description |
|---|
Pattern(Segment... segments)
Creates a pattern composed of the given segments, ordered from the most significant to the least significant
(left to right).
|
| Modifier and Type | Method and Description |
|---|---|
Version |
getFirstVersion()
Builds and returns the first version specified by this pattern, being the version with all cursors set to
0. |
Segment |
getPart(int index)
Deprecated.
Method with confusing name, use
getSegment(int) instead. Subject for removal. |
Segment |
getSegment(int index)
Returns segment at the given index (index
0 refers to the most significant one on the left). |
Version |
getVersion(String versionId)
Parses the given version ID.
|
String |
toString() |
public Pattern(@NotNull
Segment... segments)
To avoid any parsing conflicts, make sure that no neighboring segments are overlapping. Here are the two common solutions to that:
".") and create it's own segment:
Segment.literal("."). Make sure the reserved sequence does
not appear anywhere else. Then, separate each changing segment
(range with 2+ numbers, literal
segment with 2+ elements) with this segment, for example:new Pattern(Segment.range(0, Integer.MAX_VALUE), Segment.literal("."), Segment.range(0, 10))1.0 -> 1.1...
segments - the segments, ordered from left (most-significant) to right (least-significant)@Deprecated @NotNull public Segment getPart(int index)
getSegment(int) instead. Subject for removal.@NotNull public Segment getSegment(int index)
0 refers to the most significant one on the left).index - the index@Nullable public Version getVersion(@NotNull String versionId)
null.versionId - the version ID to parsenull if cannot parsepublic Version getFirstVersion()
0.Copyright © 2022. All rights reserved.