/// <summary> /// <para> /// Vector clock comparison according to the semantics described by compareTo, /// with the ability to bail out early if the we can't reach the <see cref="Ordering"/> /// that we are looking for. /// </para> /// <para> /// The ordering always starts with <see cref="Ordering.Same"/> and can then go to /// <see cref="Ordering.Same"/>, <see cref="Ordering.Before"/> or <see cref="Ordering.After"/>. /// </para> /// <para> /// <ul> /// <li>If we're on <see cref="Ordering.After"/>, then we can only go to <see cref="Ordering.After"/> or <see cref="Ordering.Concurrent"/>.</li> /// <li>If we're on <see cref="Ordering.Before"/>, then we can only go to <see cref="Ordering.Before"/>Before or <see cref="Ordering.Concurrent"/>.</li> /// <li>If we go to <see cref="Ordering.Concurrent"/>, then we exit the loop immediately></li> /// <li>If you send in the ordering <see cref="Ordering.FullOrder"/>FullOrder, then you will get a full comparison.</li> /// </ul> /// </para> /// </summary> /// <param name="that">The other vector clock to compare.</param> /// <param name="order">The desired ordering we wish to check.</param> /// <returns>The true ordering based on the contents of the vectorclock.</returns> internal Ordering CompareOnlyTo(VectorClock that, Ordering order) { if (ReferenceEquals(this, that) || Versions.Equals(that.Versions)) { return(Ordering.Same); } return(Compare(_versions.GetEnumerator(), that._versions.GetEnumerator(), order == Ordering.Concurrent ? Ordering.FullOrder : order)); }
public static void SerializeStatic(ref JsonWriter writer, ImmutableSortedDictionary <string, TValue> value, JsonSerializerOptions options) #endif { if (value is null) { writer.WriteNull(); return; } if (writer.Depth >= options.MaxDepth) { writer.Writer.WriteEmptyObject(); return; } ++writer.Depth; writer.WriteBeginObject(); var e = value.GetEnumerator(); try { if (!e.MoveNext()) { goto END; } var tuple = e.Current; var propertyName = tuple.Key; Debug.Assert(propertyName != null, nameof(propertyName) + " != null"); writer.WritePropertyName(propertyName); #if !ENABLE_IL2CPP var valueSerializer = options.Resolver.GetSerializeStatic <TValue>(); if (valueSerializer.ToPointer() != null) { writer.Serialize(tuple.Value, options, valueSerializer); while (e.MoveNext()) { writer.WriteValueSeparator(); tuple = e.Current; propertyName = tuple.Key; Debug.Assert(propertyName != null, nameof(propertyName) + " != null"); writer.WritePropertyName(propertyName); writer.Serialize(tuple.Value, options, valueSerializer); } goto END; } #endif var valueFormatter = options.Resolver.GetFormatterWithVerify <TValue>(); valueFormatter.Serialize(ref writer, tuple.Value, options); while (e.MoveNext()) { writer.WriteValueSeparator(); tuple = e.Current; propertyName = tuple.Key; Debug.Assert(propertyName != null, nameof(propertyName) + " != null"); writer.WritePropertyName(propertyName); valueFormatter.Serialize(ref writer, tuple.Value, options); } } finally { e.Dispose(); } END: writer.WriteEndObject(); --writer.Depth; }
protected override ImmutableSortedDictionary <TKey, TValue> .Enumerator GetSourceEnumerator(ImmutableSortedDictionary <TKey, TValue> source) { return(source.GetEnumerator()); }
public IEnumerator <KeyValuePair <Datum, Datum> > GetEnumerator() { return(dict.GetEnumerator()); }
public IEnumerator <KeyValuePair <string, HoconImmutableElement> > GetEnumerator() { return(!_fields.IsEmpty ? _fields.GetEnumerator() : Enumerable.Empty <KeyValuePair <string, HoconImmutableElement> >().GetEnumerator()); }
public ImmutableSortedDictionary <string, TreeEntry> .Enumerator GetEnumerator() => _items.GetEnumerator();
public ImmutableSortedDictionary <TKey, TValue> .Enumerator Invoke(ImmutableSortedDictionary <TKey, TValue> source) => source.GetEnumerator();