Exemplo n.º 1
0
 /// <inheritdoc />
 public override int GetHashCode() => EqualityHelpers.CombineHashCodes(
     Collection.GetHashCode(),
     _offset,
     _limit ?? -1,
     EqualityHelpers.GetListHashCode(_orderings),
     EqualityHelpers.GetListHashCode(_filters),
     EqualityHelpers.GetListHashCode(_projections),
     _startAt?.GetHashCode() ?? -1,
     _endAt?.GetHashCode() ?? -1);
Exemplo n.º 2
0
        // Note: these methods should be equivalent to producing the proto representations and checking those for
        // equality, but that would be expensive.

        /// <summary>
        /// Compares this query with another for equality. Every aspect of the query must be equal,
        /// including the collection. A plain Query instance is not equal to a CollectionReference instance,
        /// even if they are logically similar: <c>collection.Offset(0).Equals(collection)</c> will return
        /// <c>false</c>, even though 0 is the default offset.
        /// </summary>
        /// <param name="other">The query to compare this one with</param>
        /// <returns><c>true</c> if this query is equal to <paramref name="other"/>; <c>false</c> otherwise.</returns>
        public bool Equals(Query other)
        {
            if (ReferenceEquals(other, this))
            {
                return(true);
            }
            if (ReferenceEquals(other, null))
            {
                return(false);
            }
            if (GetType() != other.GetType())
            {
                return(false);
            }
            return(Collection.Equals(other.Collection) &&
                   _offset == other._offset &&
                   _limit == other._limit &&
                   EqualityHelpers.ListsEqual(_orderings, other._orderings) &&
                   EqualityHelpers.ListsEqual(_filters, other._filters) &&
                   EqualityHelpers.ListsEqual(_projections, other._projections) &&
                   Equals(_startAt, other._startAt) &&
                   Equals(_endAt, other._endAt));
        }
Exemplo n.º 3
0
 /// <inheritdoc />
 public override int GetHashCode() => EqualityHelpers.CombineHashCodes(Latitude.GetHashCode(), Longitude.GetHashCode());
Exemplo n.º 4
0
 /// <inheritdoc />
 public override int GetHashCode() =>
 EqualityHelpers.CombineHashCodes(Reference.GetHashCode(), Document?.Fields.GetHashCode() ?? 0);
Exemplo n.º 5
0
 public override int GetHashCode() =>
 EqualityHelpers.CombineHashCodes(Field.GetHashCode(), _op, _value?.GetHashCode() ?? -1);
Exemplo n.º 6
0
 public override int GetHashCode() => EqualityHelpers.CombineHashCodes(Field.GetHashCode(), (int)Direction);
Exemplo n.º 7
0
 /// <summary>
 /// Compares this snapshot with another for equality. The documents and query are compared;
 /// the read time is not.
 /// </summary>
 /// <param name="other">The snapshot to compare this one with</param>
 /// <returns><c>true</c> if this snapshot is equal to <paramref name="other"/>; <c>false</c> otherwise.</returns>
 public bool Equals(QuerySnapshot other) =>
 other != null &&
 Query.Equals(other.Query) &&
 EqualityHelpers.ListsEqual(Documents, other.Documents);
Exemplo n.º 8
0
 /// <inheritdoc />
 public override int GetHashCode() =>
 EqualityHelpers.CombineHashCodes(Query.GetHashCode(), EqualityHelpers.GetListHashCode(Documents));
Exemplo n.º 9
0
 // Note: even though this is order-sensitive (which is odd for set behavior), that's fine as we use a sorted set.
 /// <inheritdoc />
 public override int GetHashCode() => EqualityHelpers.GetEnumerableHashCode(_fieldPaths);
Exemplo n.º 10
0
 /// <inheritdoc />
 public override int GetHashCode() =>
 EqualityHelpers.CombineHashCodes((int)ChangeType, OldIndex ?? -1, NewIndex ?? -1, Document.GetHashCode());
Exemplo n.º 11
0
 /// <inheritdoc />
 public override int GetHashCode() => EqualityHelpers.CombineHashCodes(_seconds.GetHashCode(), _nanoseconds.GetHashCode());
Exemplo n.º 12
0
 /// <summary>
 /// Compares this set-options with another for equality.
 /// </summary>
 /// <param name="other">The set options to compare this one with</param>
 /// <returns><c>true</c> if this value is equal to <paramref name="other"/>; <c>false</c> otherwise.</returns>
 public bool Equals(SetOptions other) =>
 other != null &&
 Merge == other.Merge &&
 EqualityHelpers.ListsEqual(FieldMask, other.FieldMask);
Exemplo n.º 13
0
 /// <inheritdoc />
 public override int GetHashCode() => EqualityHelpers.CombineHashCodes(Merge ? 1 : 2, EqualityHelpers.GetListHashCode(FieldMask));