view src/main/java/christie/test/Paxos/Proposal.java @ 125:136d2a6cd0f4

fix msgpack downgrade paxos/proposal
author akahori
date Sat, 15 Dec 2018 17:58:43 +0900
parents e1e919f12ed9
children 301c1633745e
line wrap: on
line source

package christie.test.Paxos;

import christie.codegear.CodeGearManager;
import org.msgpack.annotation.Message;

@Message
public class Proposal {
    private String proposerName = "";
    private int nodeNum = 0;
    private int number = 0;
    private int value = 0;
    private int id = 0;

    public Proposal(){

    }

    public Proposal(String proposerName, int nodeNum, int value, int id){
        this.proposerName = proposerName;
        this.nodeNum = nodeNum;
        this.value = value;
        this.id = id;
        incrementNumber();

    }

    public void setValue(int value){
        this.value = value;
    }

    public int getNumber(){
        return this.number;
    }

    public int incrementNumber() {
        this.number += nodeNum + id;
        return this.number;
    }

    public Proposal getIncrementedProposal(){
        incrementNumber();
        return this;
    }

    public String getProposerName() {
        return proposerName;
    }
}