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 intcompareTo(TorVersion other)TorVersionStatusdetermineVersionStatus(java.util.SortedSet<TorVersion> recommendedVersions)Determine the version status of this tor version in the context of the given recommended tor versions.booleanequals(java.lang.Object other)inthashCode()booleanmatchingPrefix(TorVersion other)Return whether prefixes of this version and another version match.static TorVersionof(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.StringtoString()
-
-
-
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:
compareToin interfacejava.lang.Comparable<TorVersion>
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin 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:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin 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.
-
-