mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-18 20:07:19 +01:00
80 lines
2.9 KiB
Java
80 lines
2.9 KiB
Java
package org.apache.http;
|
|
|
|
import java.io.Serializable;
|
|
import org.apache.http.annotation.Contract;
|
|
import org.apache.http.annotation.ThreadingBehavior;
|
|
import org.apache.http.util.Args;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
@Contract(threading = ThreadingBehavior.IMMUTABLE)
|
|
/* loaded from: classes11.dex */
|
|
public class ProtocolVersion implements Serializable, Cloneable {
|
|
private static final long serialVersionUID = 8950662842175091068L;
|
|
protected final int major;
|
|
protected final int minor;
|
|
protected final String protocol;
|
|
|
|
public ProtocolVersion(String str, int i, int i2) {
|
|
this.protocol = (String) Args.notNull(str, "Protocol name");
|
|
this.major = Args.notNegative(i, "Protocol major version");
|
|
this.minor = Args.notNegative(i2, "Protocol minor version");
|
|
}
|
|
|
|
public Object clone() throws CloneNotSupportedException {
|
|
return super.clone();
|
|
}
|
|
|
|
public int compareToVersion(ProtocolVersion protocolVersion) {
|
|
Args.notNull(protocolVersion, "Protocol version");
|
|
Args.check(this.protocol.equals(protocolVersion.protocol), "Versions for different protocols cannot be compared: %s %s", this, protocolVersion);
|
|
int major = getMajor() - protocolVersion.getMajor();
|
|
return major == 0 ? getMinor() - protocolVersion.getMinor() : major;
|
|
}
|
|
|
|
public final boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof ProtocolVersion)) {
|
|
return false;
|
|
}
|
|
ProtocolVersion protocolVersion = (ProtocolVersion) obj;
|
|
return this.protocol.equals(protocolVersion.protocol) && this.major == protocolVersion.major && this.minor == protocolVersion.minor;
|
|
}
|
|
|
|
public ProtocolVersion forVersion(int i, int i2) {
|
|
return (i == this.major && i2 == this.minor) ? this : new ProtocolVersion(this.protocol, i, i2);
|
|
}
|
|
|
|
public final int getMajor() {
|
|
return this.major;
|
|
}
|
|
|
|
public final int getMinor() {
|
|
return this.minor;
|
|
}
|
|
|
|
public final String getProtocol() {
|
|
return this.protocol;
|
|
}
|
|
|
|
public final boolean greaterEquals(ProtocolVersion protocolVersion) {
|
|
return isComparable(protocolVersion) && compareToVersion(protocolVersion) >= 0;
|
|
}
|
|
|
|
public final int hashCode() {
|
|
return this.minor ^ (this.protocol.hashCode() ^ (this.major * 100000));
|
|
}
|
|
|
|
public boolean isComparable(ProtocolVersion protocolVersion) {
|
|
return protocolVersion != null && this.protocol.equals(protocolVersion.protocol);
|
|
}
|
|
|
|
public final boolean lessEquals(ProtocolVersion protocolVersion) {
|
|
return isComparable(protocolVersion) && compareToVersion(protocolVersion) <= 0;
|
|
}
|
|
|
|
public String toString() {
|
|
return this.protocol + '/' + Integer.toString(this.major) + '.' + Integer.toString(this.minor);
|
|
}
|
|
}
|