jaulib v1.3.0
Jau Support Library (C++, Java, ..)
VersionNumberString.java
Go to the documentation of this file.
1/**
2 * Author: Sven Gothel <sgothel@jausoft.com>
3 * Copyright (c) 2021 Gothel Software e.K.
4 * Copyright (c) 2010 Gothel Software e.K.
5 * Copyright (c) 2010 JogAmp Community.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining
8 * a copy of this software and associated documentation files (the
9 * "Software"), to deal in the Software without restriction, including
10 * without limitation the rights to use, copy, modify, merge, publish,
11 * distribute, sublicense, and/or sell copies of the Software, and to
12 * permit persons to whom the Software is furnished to do so, subject to
13 * the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be
16 * included in all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 */
26
27package org.jau.util;
28
29/**
30 * {@link VersionNumber} specialization, holding the <code>versionString</code>
31 * this instance is derived from.
32 */
33public class VersionNumberString extends VersionNumber {
34
35 /**
36 * A {@link #isZero() zero} version instance, w/o any component defined explicitly.
37 * @see #hasMajor()
38 * @see #hasMinor()
39 * @see #hasSub()
40 */
41 public static final VersionNumberString zeroVersion = new VersionNumberString(0, 0, 0, -1, (short)0, "n/a");
42
43 protected final String strVal;
44
45 protected VersionNumberString(final int majorRev, final int minorRev, final int subMinorRev, final int strEnd, final short _state, final String versionString) {
46 super(majorRev, minorRev, subMinorRev, strEnd, _state);
47 strVal = versionString;
48 }
49
50 /**
51 * See {@link VersionNumber#VersionNumber(int, int, int)}.
52 */
53 public VersionNumberString(final int majorRev, final int minorRev, final int subMinorRev, final String versionString) {
54 this(majorRev, minorRev, subMinorRev, -1, (short)(HAS_MAJOR | HAS_MINOR | HAS_SUB), versionString);
55 }
56
57 /**
58 * See {@link VersionNumber#VersionNumber(String)}.
59 */
60 public VersionNumberString(final String versionString) {
61 super( versionString);
62 strVal = versionString;
63 }
64
65 /**
66 * See {@link VersionNumber#VersionNumber(String, String)}.
67 */
68 public VersionNumberString(final String versionString, final String delim) {
69 super( versionString, delim);
70 strVal = versionString;
71 }
72
73 /**
74 * See {@link VersionNumber#VersionNumber(String, java.util.regex.Pattern)}.
75 */
76 public VersionNumberString(final String versionString, final java.util.regex.Pattern versionPattern) {
77 super( versionString, versionPattern);
78 strVal = versionString;
79 }
80
81 /** Returns the version string this version number is derived from. */
82 public final String getVersionString() { return strVal; }
83
84 @Override
85 public String toString() {
86 return super.toString() + " ("+strVal+")" ;
87 }
88}
VersionNumber specialization, holding the versionString this instance is derived from.
VersionNumberString(final String versionString, final java.util.regex.Pattern versionPattern)
See VersionNumber#VersionNumber(String, java.util.regex.Pattern).
static final VersionNumberString zeroVersion
A zero version instance, w/o any component defined explicitly.
final String getVersionString()
Returns the version string this version number is derived from.
VersionNumberString(final String versionString, final String delim)
See VersionNumber#VersionNumber(String, String).
VersionNumberString(final int majorRev, final int minorRev, final int subMinorRev, final int strEnd, final short _state, final String versionString)
VersionNumberString(final int majorRev, final int minorRev, final int subMinorRev, final String versionString)
See VersionNumber#VersionNumber(int, int, int).
VersionNumberString(final String versionString)
See VersionNumber#VersionNumber(String).
Simple version number class containing a version number either being defined explicit or derived from...
static final short HAS_SUB
static final short HAS_MINOR
static final short HAS_MAJOR