60 lines
1.7 KiB
Java
60 lines
1.7 KiB
Java
package androidx.work.impl.constraints;
|
|
|
|
import androidx.annotation.NonNull;
|
|
public class NetworkState {
|
|
private boolean mIsConnected;
|
|
private boolean mIsMetered;
|
|
private boolean mIsNotRoaming;
|
|
private boolean mIsValidated;
|
|
|
|
public NetworkState(boolean z2, boolean z3, boolean z4, boolean z5) {
|
|
this.mIsConnected = z2;
|
|
this.mIsValidated = z3;
|
|
this.mIsMetered = z4;
|
|
this.mIsNotRoaming = z5;
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof NetworkState)) {
|
|
return false;
|
|
}
|
|
NetworkState networkState = (NetworkState) obj;
|
|
return this.mIsConnected == networkState.mIsConnected && this.mIsValidated == networkState.mIsValidated && this.mIsMetered == networkState.mIsMetered && this.mIsNotRoaming == networkState.mIsNotRoaming;
|
|
}
|
|
|
|
public int hashCode() {
|
|
int i = this.mIsConnected ? 1 : 0;
|
|
if (this.mIsValidated) {
|
|
i += 16;
|
|
}
|
|
if (this.mIsMetered) {
|
|
i += 256;
|
|
}
|
|
return this.mIsNotRoaming ? i + 4096 : i;
|
|
}
|
|
|
|
public boolean isConnected() {
|
|
return this.mIsConnected;
|
|
}
|
|
|
|
public boolean isMetered() {
|
|
return this.mIsMetered;
|
|
}
|
|
|
|
public boolean isNotRoaming() {
|
|
return this.mIsNotRoaming;
|
|
}
|
|
|
|
public boolean isValidated() {
|
|
return this.mIsValidated;
|
|
}
|
|
|
|
@NonNull
|
|
public String toString() {
|
|
return String.format("[ Connected=%b Validated=%b Metered=%b NotRoaming=%b ]", Boolean.valueOf(this.mIsConnected), Boolean.valueOf(this.mIsValidated), Boolean.valueOf(this.mIsMetered), Boolean.valueOf(this.mIsNotRoaming));
|
|
}
|
|
}
|