Top Description Inners Fields Constructors Methods
org.jabref.logic.util

public Class Version

extends Object
Class Inheritance
Imports
java.io.BufferedReader, .IOException, .InputStreamReader, java.net.HttpURLConnection, .URL, java.util.ArrayList, .List, .Objects, .Optional, java.util.regex.Matcher, .Pattern, kong.unirest.core.json.JSONArray, kong.unirest.core.json.JSONObject, org.slf4j.Logger, .LoggerFactory

Represents the Application Version with the major and minor number, the full Version String and if it's a developer version

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum

Field Summary

Modifier and TypeField and Description
private static final Pattern
private int
private Version.DevelopmentStage
private String
private boolean
public static final String
private static final String
private int
private int
private int
private static final Version
private static final Pattern

Constructor Summary

AccessConstructor and Description
private
Version()

Dummy constructor to create a local object (and Version#UNKNOWN_VERSION)

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
other
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public static List<Version>
getAllAvailableVersions()

Grabs all the available releases from the GitHub repository

public String

Returns:

The link to the changelog on GitHub to this specific version (https://github.com/JabRef/jabref/blob/vX.X/CHANGELOG.md)
getChangelogUrl
()

public int
public String
private static Logger
getLogger()

Tinylog does not allow for altering existing loging configuraitons after the logger was initialized .

public int
public int
public int
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public boolean
public boolean

Returns:

true if this version is newer than the passed one
isNewerThan
(Version otherVersion)

public static Version

Returns:

the parsed version or Version#UNKNOWN_VERSION if an error occurred
parse
(String
must be in form of following pattern: (\d+)(\.(\d+))?(\.(\d+))?(-alpha|-beta)?(-?dev)? (e.g., 3.3; 3.4-dev)
version
)

public Optional<Version>

Returns:

The version this one should be updated to, or an empty Optional
shouldBeUpdatedTo
(List<Version> availableVersions)

Checks if this version should be updated to one of the given ones.

public boolean

Returns:

True if this version should be updated to the given one
shouldBeUpdatedTo
(Version otherVersion)

Checks if this version should be updated to the given one.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

CI_SUFFIX_PATTERNback to summary
private static final Pattern CI_SUFFIX_PATTERN
developmentNumback to summary
private int developmentNum
developmentStageback to summary
private Version.DevelopmentStage developmentStage
fullVersionback to summary
private String fullVersion
isDevelopmentVersionback to summary
private boolean isDevelopmentVersion
JABREF_DOWNLOAD_URLback to summary
public static final String JABREF_DOWNLOAD_URL
JABREF_GITHUB_RELEASESback to summary
private static final String JABREF_GITHUB_RELEASES
majorback to summary
private int major
minorback to summary
private int minor
patchback to summary
private int patch
UNKNOWN_VERSIONback to summary
private static final Version UNKNOWN_VERSION
VERSION_PATTERNback to summary
private static final Pattern VERSION_PATTERN

Constructor Detail

Versionback to summary
private Version()

Dummy constructor to create a local object (and Version#UNKNOWN_VERSION)

Method Detail

equalsback to summary
public boolean equals(Object other)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
other:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getAllAvailableVersionsback to summary
public static List<Version> getAllAvailableVersions() throws IOException

Grabs all the available releases from the GitHub repository

getChangelogUrlback to summary
public String getChangelogUrl()
Returns:String

The link to the changelog on GitHub to this specific version (https://github.com/JabRef/jabref/blob/vX.X/CHANGELOG.md)

getDevelopmentNumback to summary
public int getDevelopmentNum()
getFullVersionback to summary
public String getFullVersion()
getLoggerback to summary
private static Logger getLogger()

Tinylog does not allow for altering existing loging configuraitons after the logger was initialized . Lazy initialization to enable tinylog writing to a file (and also still enabling loggin in this class)

getMajorback to summary
public int getMajor()
getMinorback to summary
public int getMinor()
getPatchback to summary
public int getPatch()
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
isDevelopmentVersionback to summary
public boolean isDevelopmentVersion()
isNewerThanback to summary
public boolean isNewerThan(Version otherVersion)
Returns:boolean

true if this version is newer than the passed one

parseback to summary
public static Version parse(String version)
Parameters
version:String

must be in form of following pattern: (\d+)(\.(\d+))?(\.(\d+))?(-alpha|-beta)?(-?dev)? (e.g., 3.3; 3.4-dev)

Returns:Version

the parsed version or Version#UNKNOWN_VERSION if an error occurred

shouldBeUpdatedToback to summary
public Optional<Version> shouldBeUpdatedTo(List<Version> availableVersions)

Checks if this version should be updated to one of the given ones. Ignoring the other Version if this one is Stable and the other one is not.

Returns:Optional<Version>

The version this one should be updated to, or an empty Optional

shouldBeUpdatedToback to summary
public boolean shouldBeUpdatedTo(Version otherVersion)

Checks if this version should be updated to the given one. Ignoring the other Version if this one is Stable and the other one is not.

Returns:boolean

True if this version should be updated to the given one

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
org.jabref.logic.util back to summary

public final Enum Version.DevelopmentStage

extends Enum<Version.DevelopmentStage>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final Version.DevelopmentStage
public static final Version.DevelopmentStage
private final int
stability

describes how stable this stage is, the higher the better

public static final Version.DevelopmentStage
private final String
public static final Version.DevelopmentStage

Constructor Summary

AccessConstructor and Description
private
DevelopmentStage(String stage, int stability)

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if this stage is more stable than the otherStage
isMoreStableThan
(Version.DevelopmentStage otherStage)

public static Version.DevelopmentStage
parse(String stage)

public static Version.DevelopmentStage
public static Version.DevelopmentStage[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

ALPHAback to summary
public static final Version.DevelopmentStage ALPHA
BETAback to summary
public static final Version.DevelopmentStage BETA
stabilityback to summary
private final int stability

describes how stable this stage is, the higher the better

STABLEback to summary
public static final Version.DevelopmentStage STABLE
stageback to summary
private final String stage
UNKNOWNback to summary
public static final Version.DevelopmentStage UNKNOWN

Constructor Detail

DevelopmentStageback to summary
private DevelopmentStage(String stage, int stability)

Method Detail

isMoreStableThanback to summary
public boolean isMoreStableThan(Version.DevelopmentStage otherStage)
Returns:boolean

true if this stage is more stable than the otherStage

parseback to summary
public static Version.DevelopmentStage parse(String stage)
valueOfback to summary
public static Version.DevelopmentStage valueOf(String name)
valuesback to summary
public static Version.DevelopmentStage[] values()