Example #1
0
 internal PruningState Merge(PruningState that)
 {
     if (Phase is PruningPerformed)
     {
         return(this);
     }
     if (that.Phase is PruningPerformed)
     {
         return(that);
     }
     if (Phase is PruningInitialized && that.Phase is PruningInitialized)
     {
         var p1 = (PruningInitialized)Phase;
         var p2 = (PruningInitialized)that.Phase;
         if (this.Owner == that.Owner)
         {
             return(new PruningState(Owner, new PruningInitialized(p1.Seen.Union(p2.Seen))));
         }
         else if (Member.AddressOrdering.Compare(this.Owner.Address, that.Owner.Address) > 0)
         {
             return(that);
         }
         else
         {
             return(this);
         }
     }
     else
     {
         throw new Exception("Invalid pruning state provided");
     }
 }
Example #2
0
        private bool Equals(PruningState other)
        {
            if (ReferenceEquals(other, null))
            {
                return(false);
            }
            if (ReferenceEquals(other, this))
            {
                return(true);
            }

            return(Equals(Owner, other.Owner) && Equals(Phase, other.Phase));
        }