Beispiel #1
0
     public bool Equals(StatePayload <TState, TValue> other)
     {
 #if PayloadAsClass
         other.ContractedNotNull("other");
 #endif
         return(this.Value.Equals(other.Value) && this.State.Equals(other.State));
     }
Beispiel #2
0
        public static State <TState, TValue> ToState(StatePayload <TState, TValue> payload)
        {
    #if PayloadAsClass
            payload.ContractedNotNull("payload");
    #endif
            Contract.Ensures(Contract.Result <State <TState, TValue> >() != null);

            return(s => payload);
        }
Beispiel #3
0
        /// <summary>Generates an unending stream of successive StatePayload&amp;TState,T> objects.</summary>
        public static IEnumerable <StatePayload <TState, TValue> > Enumerate <TState, TValue>(this
                                                                                              State <TState, TValue> @this,
                                                                                              TState startState
                                                                                              )
        {
            @this.ContractedNotNull("this");
            Contract.Ensures(Contract.Result <IEnumerable <StatePayload <TState, TValue> > >() != null);

            var payload = new StatePayload <TState, TValue>(startState, default(TValue));

            while (true)
            {
                yield return(payload = @this(payload.State));
            }
        }
Beispiel #4
0
 [Pure] bool IEquatable <StatePayload <TState, TValue> > .Equals(StatePayload <TState, TValue> other)
 {
     return(this.Equals(other));
 }