Esempio n. 1
0
        public DottedVersionVector(CausalEvent dot, VersionVector v)
        {
            Ensure.That(dot, "dot").IsNotNull();
            Ensure.That(v, "v").IsNotNull();

            _dot = dot;
            _v   = v;
        }
Esempio n. 2
0
        /// <summary>
        /// Generates a new clock.
        /// </summary>
        public DottedVersionVector Event(VersionVector context, Siblings s, string i)
        {
            Ensure.That(s, "s").IsNotNull();
            Ensure.That(context, "context").IsNotNull();
            Ensure.That(i, "i").IsNotNullOrEmpty();

            long maxDot           = s.MaxDot(i);
            long maxCausalHistory = context[i];

            long maxCounter = Math.Max(maxDot, maxCausalHistory);
            var  dot        = new CausalEvent(i, maxCounter + 1);

            return(new DottedVersionVector(dot, context));
        }
Esempio n. 3
0
 public VersionVector(CausalEvent @event) : this()
 {
     _events.Add(@event.I, @event.N);
 }