Class JTSVersion

 1 /*
 2  * Copyright (c) 2016 Vivid Solutions.
 3  *
 4  * All rights reserved. This program and the accompanying materials
 5  * are made available under the terms of the Eclipse Public License 2.0
 6  * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
 7  * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v20.html
 8  * and the Eclipse Distribution License is available at
 9  *
10  * http://www.eclipse.org/org/documents/edl-v10.php.
11  */
12  
13 package org.locationtech.jts;
14  
15 /**
16  * JTS API version information.
17  * <p>
18  * Versions consist of a 3-part version number: <code>major.minor.patch</code>
19  * An optional release status string may be present in the string version of
20  * the version.
21  *
22  * @version 1.7
23  */
24 public class JTSVersion {
25  
26   /**
27    * The current version number of the JTS API.
28    */
29   public static final JTSVersion CURRENT_VERSION = new JTSVersion();
30  
31   /**
32    * The major version number.
33    */
34   public static final int MAJOR = 1;
35  
36   /**
37    * The minor version number.
38    */
39   public static final int MINOR = 17;
40  
41   /**
42    * The patch version number.
43    */
44   public static final int PATCH = 1;
45  
46   /**
47    * An optional string providing further release info (such as "alpha 1");
48    */
49   private static final String RELEASE_INFO = "";
50  
51   /**
52    * Prints the current JTS version to stdout.
53    *
54    * @param args the command-line arguments (none are required).
55    */
56   public static void main(String[] args)
57   {
58     System.out.println(CURRENT_VERSION);
59   }
60  
61   private JTSVersion() {
62   }
63  
64   /**
65    * Gets the major number of the release version.
66    *
67    * @return the major number of the release version.
68    */
69   public int getMajor() { return MAJOR; }
70  
71   /**
72    * Gets the minor number of the release version.
73    *
74    * @return the minor number of the release version.
75    */
76   public int getMinor() { return MINOR; }
77  
78   /**
79    * Gets the patch number of the release version.
80    *
81    * @return the patch number of the release version.
82    */
83   public int getPatch() { return PATCH; }
84  
85   /**
86    * Gets the full version number, suitable for display.
87    *
88    * @return the full version number, suitable for display.
89    */
90   public String toString()
91   {
92     String ver = MAJOR + "." + MINOR + "." + PATCH;
93     if (RELEASE_INFO != null && RELEASE_INFO.length() > 0)
94       return ver + " " + RELEASE_INFO;
95     return ver;
96   }
97  
98 }
99