mirror of
https://github.com/octoleo/plantuml.git
synced 2024-12-22 02:49:06 +00:00
chore: simply Version.java implementation
This commit is contained in:
parent
eb85d9c9c5
commit
35ec8a700c
@ -39,55 +39,38 @@ import java.util.Date;
|
||||
|
||||
import net.sourceforge.plantuml.log.Logme;
|
||||
import net.sourceforge.plantuml.security.SURL;
|
||||
import net.sourceforge.plantuml.utils.SignatureUtils;
|
||||
|
||||
public class Version {
|
||||
// ::remove folder when __HAXE__
|
||||
|
||||
private static final int MAJOR_SEPARATOR = 1000000;
|
||||
|
||||
public static int version() {
|
||||
return 1202307;
|
||||
}
|
||||
|
||||
public static int versionPatched() {
|
||||
if (beta() != 0) {
|
||||
return version() + 1;
|
||||
}
|
||||
return version();
|
||||
}
|
||||
private static final String version = "1.2023.8beta2";
|
||||
|
||||
public static String versionString() {
|
||||
if (beta() != 0) {
|
||||
return dotted(version() + 1) + "beta" + beta();
|
||||
}
|
||||
return dotted(version());
|
||||
return version;
|
||||
}
|
||||
|
||||
public static String fullDescription() {
|
||||
return "PlantUML version " + Version.versionString() + " (" + Version.compileTimeString() + ")";
|
||||
}
|
||||
|
||||
private static String dotted(int nb) {
|
||||
final String minor = "" + nb % MAJOR_SEPARATOR;
|
||||
final String major = "" + nb / MAJOR_SEPARATOR;
|
||||
return major + "." + minor.substring(0, 4) + "." + Integer.parseInt(minor.substring(4));
|
||||
}
|
||||
|
||||
public static String versionString(int size) {
|
||||
final StringBuilder sb = new StringBuilder(versionString());
|
||||
while (sb.length() < size) {
|
||||
while (sb.length() < size)
|
||||
sb.append(' ');
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static int beta() {
|
||||
final int beta = 2;
|
||||
return beta;
|
||||
final int x = version.indexOf("beta");
|
||||
if (x == -1)
|
||||
return 0;
|
||||
return Integer.parseInt(version.substring(x + "beta".length()));
|
||||
}
|
||||
|
||||
public static String etag() {
|
||||
return Integer.toString(version() % MAJOR_SEPARATOR - 201670, 36) + Integer.toString(beta(), 36);
|
||||
return SignatureUtils.getMD5Hex(version);
|
||||
}
|
||||
|
||||
public static String turningId() {
|
||||
@ -99,9 +82,9 @@ public class Version {
|
||||
}
|
||||
|
||||
public static String compileTimeString() {
|
||||
if (beta() != 0) {
|
||||
if (version.contains("beta"))
|
||||
return "Unknown compile time";
|
||||
}
|
||||
|
||||
return new Date(Version.compileTime()).toString();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user