1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-06-02 08:30:49 +00:00
plantuml/src/net/sourceforge/plantuml/version/Version.java

101 lines
2.5 KiB
Java
Raw Normal View History

2010-11-15 20:35:36 +00:00
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
2016-01-09 12:15:40 +00:00
* (C) Copyright 2009-2017, Arnaud Roques
2010-11-15 20:35:36 +00:00
*
2016-03-06 16:47:34 +00:00
* Project Info: http://plantuml.com
2010-11-15 20:35:36 +00:00
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
2013-12-10 19:36:50 +00:00
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
2010-11-15 20:35:36 +00:00
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.version;
2015-05-31 18:56:03 +00:00
import java.net.URL;
2015-04-07 18:18:37 +00:00
import java.util.Date;
2010-11-15 20:35:36 +00:00
public class Version {
public static int version() {
2017-03-12 17:22:02 +00:00
return 8058;
2013-12-10 19:36:50 +00:00
}
public static String versionString() {
2016-05-11 21:31:47 +00:00
if (beta() != 0) {
2015-04-07 18:18:37 +00:00
return "" + (version() + 1) + "beta" + beta();
2013-12-10 19:36:50 +00:00
}
return "" + version();
}
2015-05-03 15:36:36 +00:00
public static String versionString(int size) {
final StringBuilder sb = new StringBuilder(versionString());
while (sb.length() < size) {
sb.append(' ');
}
return sb.toString();
}
2017-03-12 17:22:02 +00:00
public static int beta() {
2015-04-07 18:18:37 +00:00
final int beta = 0;
return beta;
}
2016-06-19 14:16:41 +00:00
private static String int2shortString(int v) {
return Integer.toString(v % 36, 36);
}
public static String turningId() {
return int2shortString(version()) + int2shortString(beta());
}
2016-05-11 21:31:47 +00:00
public static long compileTime() {
2017-03-12 17:22:02 +00:00
return 1489318411026L;
2010-11-15 20:35:36 +00:00
}
2015-04-07 18:18:37 +00:00
public static String compileTimeString() {
if (beta() != 0) {
return versionString();
}
return new Date(Version.compileTime()).toString();
2010-11-15 20:35:36 +00:00
}
2015-05-31 18:56:03 +00:00
public static String getJarPath() {
try {
final ClassLoader loader = Version.class.getClassLoader();
if (loader == null) {
return "No ClassLoader?";
}
final URL url = loader.getResource("net/sourceforge/plantuml/version/Version.class");
if (url == null) {
return "No URL?";
}
String fullpath = url.toString();
fullpath = fullpath.replaceAll("net/sourceforge/plantuml/version/Version\\.class", "");
return fullpath;
} catch (Throwable t) {
t.printStackTrace();
return t.toString();
}
}
2010-11-15 20:35:36 +00:00
}