forked from openlcb/OpenLCB_Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVersion.java
More file actions
88 lines (76 loc) · 2.59 KB
/
Version.java
File metadata and controls
88 lines (76 loc) · 2.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package org.openlcb;
/**
* Defines a simple place to get the OpenLCB library version string.
* <P>
* Note that there are separate version numbers for the OpenLCB spec
* and the library itself. By convention, these agree in the 1st
* two places.
* <P>
* You have to manually keep this synchronized with the manifest file.
*
* @author Bob Jacobsen Copyright 2011 - 2024
*/
public class Version {
/**
* Major number changes with large incompatible
* changes in requirements or API.
*/
static final public int major = 0;
/**
* Minor number changes with change that
* effects interoperability
*/
static final public int minor = 8;
/* Specification modifier - updated periodically
*/
static final public int specMod = 6;
/* Library modifier - updated periodically
*/
static final public int libMod = 6;
/**
* Checks if the current specification version is above a specific threshold.
* @param maj threshold major version
* @param min threshold minor version
* @param mod threshold specification modifier
* @return true if current specification version >= maj.min.mod
*/
static public boolean specVersionAtLeast(int maj, int min, int mod) {
return major > maj || minor > min || specMod >= mod;
}
/**
* Checks if the current library version is above a specific threshold.
* @param maj threshold major version
* @param min threshold minor version
* @param mod threshold library modifier
* @return true if current library version >= maj.min.mod
*/
static public boolean libVersionAtLeast(int maj, int min, int mod) {
return major > maj || minor > min || libMod >= mod;
}
/**
* Provide the current specification version string.
*
* @return The current specification version string
*/
static public String specVersion() {
return ""+major+"."+minor+"."+specMod;
}
/**
* Provide the current library version string.
*
* @return The current library version string
*/
static public String libVersion() {
return ""+major+"."+minor+"."+libMod;
}
/**
* Standalone print of version string and exit.
*
* This is used in the build.xml to generate parts of the installer release file name, so
* take care in altering this code to make sure the ant recipes are also suitably modified.
* @param args commandline
*/
static public void main(String[] args) {
System.out.println(specVersion()+" "+libVersion());
}
}