| 89 | } |
| 90 | |
| 91 | func (uav UserAgentVersion) IsEqualToOrAfter(otherMajorVersion, otherMinorVersion int) bool { |
| 92 | |
| 93 | // if our major version is less than their major version, then there's no |
| 94 | // way we could be after their overall version, so return false |
| 95 | if uav.MajorVersion() < otherMajorVersion { |
| 96 | return false |
| 97 | } |
| 98 | |
| 99 | // if our major version is greater than their major version, we're definitely |
| 100 | // after so return true |
| 101 | if uav.MajorVersion() > otherMajorVersion { |
| 102 | return true |
| 103 | } |
| 104 | |
| 105 | // the major versions are equal, so it's down to minor versions. |
| 106 | // if we're strictly after their minor version, return true |
| 107 | if uav.MinorVersion() >= otherMinorVersion { |
| 108 | return true |
| 109 | } |
| 110 | |
| 111 | // looks like we're less than their minor version, so return false |
| 112 | return false |
| 113 | |
| 114 | } |
| 115 | |
| 116 | func (uav UserAgentVersion) IsBefore(otherMajorVersion, otherMinorVersion int) bool { |
| 117 | return !uav.IsEqualToOrAfter(otherMajorVersion, otherMinorVersion) |