示例#1
0
        /// <summary>
        /// Fork a stamp into 2 distinct stamps (as out parameters)
        /// </summary>
        /// <param name="source">The source stamp.</param>
        /// <param name="s1">1st stamp with a unique identity and a copy of the causal history.</param>
        /// <param name="s2">2nd stamp with a unique identity and a copy of the causal history.</param>
        /// <remarks>
        /// A convenience method when out parameters are preferred over a return 2-tuple.
        /// </remarks>
        public static void Fork(this Stamp source, out Stamp s1, out Stamp s2)
        {
            var forked = source.Fork();

            s1 = forked.Item1;
            s2 = forked.Item2;
        }
示例#2
0
        /// <summary>
        /// Fork a stamp into 3 distinct stamps (returns a 3-tuple)
        /// </summary>
        /// <param name="source">The source stamp.</param>
        /// <returns>A 3-tuple, each with a unique identity and a copy of the causal history.</returns>
        /// <remarks>
        /// A convenience method for forking 1 stamp into 3 unique stamps.
        /// </remarks>
        public static (Stamp, Stamp, Stamp) Fork3(this Stamp source)
        {
            (Stamp, Stamp)fork = source.Fork();
            Stamp a = fork.Item1;
            Stamp c = fork.Item2;

            (Stamp, Stamp)fork1 = a.Fork();
            a = fork1.Item1;
            Stamp b = fork1.Item2;

            return(a, b, c);
        }