Class TorVersion
- java.lang.Object
-
- org.torproject.metrics.onionoo.updater.TorVersion
-
- All Implemented Interfaces:
java.lang.Comparable<TorVersion>
public class TorVersion extends java.lang.Object implements java.lang.Comparable<TorVersion>
Helper class to compare Tor versions.Based on "How Tor Version Numbers Work", available at https://gitweb.torproject.org/torspec.git/tree/version-spec.txt
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(TorVersion other)
TorVersionStatus
determineVersionStatus(java.util.SortedSet<TorVersion> recommendedVersions)
Determine the version status of this tor version in the context of the given recommended tor versions.boolean
equals(java.lang.Object other)
int
hashCode()
boolean
matchingPrefix(TorVersion other)
Return whether prefixes of this version and another version match.static TorVersion
of(java.lang.String versionString)
Return a TorVersion instance from the given tor version string that can be compared to other tor version strings, or null if the given string is not a valid tor version.java.lang.String
toString()
-
-
-
Method Detail
-
of
public static TorVersion of(java.lang.String versionString)
Return a TorVersion instance from the given tor version string that can be compared to other tor version strings, or null if the given string is not a valid tor version.
-
compareTo
public int compareTo(TorVersion other)
- Specified by:
compareTo
in interfacejava.lang.Comparable<TorVersion>
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
matchingPrefix
public boolean matchingPrefix(TorVersion other)
Return whether prefixes of this version and another version match.Two versions A and B have the same prefix if A starts with B, B starts with A, or A and B are the same.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
determineVersionStatus
public TorVersionStatus determineVersionStatus(java.util.SortedSet<TorVersion> recommendedVersions)
Determine the version status of this tor version in the context of the given recommended tor versions.
-
-