示例#1
0
            public static Message CreateUpdateMessage(decimal balance, VectorClockImpl clock)
            {
                Message msg = new Message();

                msg.type = MessageType.Communication;
                msg.communicationBlock.clock           = clock;
                msg.communicationBlock.payload.balance = balance;

                return(msg);
            }
示例#2
0
        public ComparisonResult Compare(VectorClockImpl other)
        {
            bool a = other[this.id] < this[id];
            bool b = this[other.id] < other[other.id];

            if (a && b)
            {
                return(ComparisonResult.Concurrent);
            }
            else if (a)
            {
                return(ComparisonResult.After);
            }
            else
            {
                return(ComparisonResult.Before); // or Equal
            }
        }
示例#3
0
 public void update(VectorClockImpl other)
 {
     this.timestamps = other.timestamps;
 }
示例#4
0
 public VectorClockImpl(VectorClockImpl input)
 {
     this.timestamps = input.timestamps;
     this.id         = input.id;
 }
示例#5
0
 public CommunicationBlock()
 {
     clock   = new VectorClockImpl(-1);
     payload = new CommunicationPayload();
 }
示例#6
0
 public CommunicationBlock(CommunicationBlock input)
 {
     clock   = new VectorClockImpl(input.clock);
     payload = new CommunicationPayload(input.payload);
 }