public class Version extends Object implements Comparable<Version>
1.4 or 1.2-alpha).
Each version is defined by a Pattern and an array of cursors, each corresponding to one pattern Segment. A cursor represents the index of the element of that Segment which is forming the version ID and
each time any cursor changes, the ID representation is rebuilt and cached.
| Modifier and Type | Method and Description |
|---|---|
String |
asID()
|
int |
compareTo(Version o) |
Version |
copy()
Creates a copy of this version object.
|
boolean |
equals(Object o) |
int |
getCursor(int index)
Returns the cursor corresponding to
pattern segment at the given index. |
Pattern |
getPattern()
Returns the versions' pattern (was also used to parse the version).
|
int |
hashCode() |
void |
next()
Moves to the next version (accordingly to the
pattern). |
String |
toString() |
public int compareTo(Version o)
compareTo in interface Comparable<Version>public int getCursor(int index)
pattern segment at the given index. The given index
must be >= 0, simultaneously less than the amount of segments defining the pattern.
The returned cursor is guaranteed to be >= 0 and less than the corresponding segment's length.
index - the index of the cursor to returnpublic void next()
pattern).
More formally, shifts the cursor of the least significant segment (on the right). If it was the last element in
the segment's definition, resets the cursor to 0 (first element) and shifts the cursor of 2nd least
significant part (just to the left) the same way.
For example, 1.2 -> 1.3 (depending on the pattern configuration, just for
illustration).
public String asID()
public Version copy()
More formally, only makes a shallow copy of the cursor indexes.
public Pattern getPattern()
Copyright © 2022. All rights reserved.