public override bool Equals(object obj) { if (obj == null) { return(false); } if (!(obj is DefaultElectionCredentials)) { return(false); } DefaultElectionCredentials other = ( DefaultElectionCredentials )obj; return(other._serverId == this._serverId && other._latestTxId == this._latestTxId && other._currentWinner == this._currentWinner); }
public override int CompareTo(ElectionCredentials o) { DefaultElectionCredentials other = ( DefaultElectionCredentials )o; if (this._latestTxId == other._latestTxId) { // Smaller id means higher priority if (this._currentWinner == other._currentWinner) { return(Integer.compare(other._serverId, this._serverId)); } else { return(other._currentWinner ? -1 : 1); } } else { return(Long.compare(this._latestTxId, other._latestTxId)); } }