$darkmode
DENOPTIM
Version.java
Go to the documentation of this file.
1/*
2 * DENOPTIM
3 * Copyright (C) 2019 Vishwesh Venkatraman <vishwesh.venkatraman@ntnu.no>
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Affero General Public License as published
7 * by the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Affero General Public License for more details.
14 *
15 * You should have received a copy of the GNU Affero General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19package denoptim.logging;
20
21import java.io.IOException;
22import java.util.Properties;
23
24import denoptim.constants.DENOPTIMConstants;
25import denoptim.main.Main;
26
35public class Version
36{
37 public static final String NAME = "DENOPTIM";
38 public static final String AUTHORS = "Vishwesh Venkatraman, Marco Foscato";
39 public static final String CONTRIBUTORS = "David Grellscheid, "
40 + "Einar Kjellback, "
41 + "Marcello Costamagna";
42 public static final String CONTACT = "see https://github.com/denoptim-project";
43 public static final String MINIMUMJAVAVERSION = "1.8";
44
48 public static final String VERSION;
49 static {
50 final Properties properties = new Properties();
51 String tmpVersion = "VersionNotFound";
52 try
53 {
54 properties.load(Main.class.getClassLoader().getResourceAsStream(
55 "project.properties"));
56 tmpVersion = properties.getProperty("version");
57 } catch (IOException e)
58 {
59 e.printStackTrace();
60 }
61 VERSION = tmpVersion;
62 };
63
67 public static final String DATE;
68 static {
69 final Properties properties = new Properties();
70 String tmpVersion = "BuildDateNotFound";
71 try
72 {
73 properties.load(Main.class.getClassLoader().getResourceAsStream(
74 "project.properties"));
75 tmpVersion = properties.getProperty("build_date");
76 } catch (IOException e)
77 {
78 e.printStackTrace();
79 }
80 DATE = tmpVersion;
81 };
82
83//------------------------------------------------------------------------------
84
89 public static String buildDenoptimHeader()
90 {
91 Properties p = System.getProperties();
92 String javaVersion = p.getProperty("java.version");
93 String javaVM = p.getProperty("java.vm.name");
94 String javaVMVersion = p.getProperty("java.vm.version");
95 if (javaVM != null)
96 javaVersion = javaVersion + " / " + javaVM;
97 if (javaVM != null && javaVMVersion != null)
98 javaVersion = javaVersion + "-" + javaVMVersion;
99
100 String NL = DENOPTIMConstants.EOL;
101 return NL + "| " + NAME +
102 NL + "| DENovo OPTimization of In/organic Molecules (" + VERSION + ")" +
103 NL + "| By " + AUTHORS +
104 NL + "| Contributors: " + CONTRIBUTORS +
105 NL + "| Contact: " + CONTACT +
106 NL + "| Date: " + DATE +
107 NL + "| Current Java: " + javaVersion +
108 NL + "| Required Minimum Java: " + MINIMUMJAVAVERSION +
109 NL + NL;
110 }
111
112//------------------------------------------------------------------------------
113
114}
General set of constants used in DENOPTIM.
static final String EOL
new line character
Class handling DENOPTIM's version identifier for headers.
Definition: Version.java:36
static final String DATE
Build date (from Maven properties)
Definition: Version.java:67
static String buildDenoptimHeader()
Builds the header with version, authors, contributors, and.
Definition: Version.java:89
static final String CONTRIBUTORS
Definition: Version.java:39
static final String AUTHORS
Definition: Version.java:38
static final String CONTACT
Definition: Version.java:42
static final String NAME
Definition: Version.java:37
static final String MINIMUMJAVAVERSION
Definition: Version.java:43
static final String VERSION
Version identifier (from pom.xml via Maven properties)
Definition: Version.java:48
Entry point of any kind of run of the DENOPTIM program.
Definition: Main.java:58