Mercurial > hg > Database > Christie
view src/main/java/christie/test/topology/paxos/Proposal.java @ 159:a0391cfdcef6
update topologymanager
author | akahori |
---|---|
date | Mon, 21 Jan 2019 18:02:49 +0900 |
parents | src/main/java/christie/test/Paxos/Proposal.java@7a2108775da7 |
children | 6ea1f8958d1a |
line wrap: on
line source
package christie.test.topology.paxos; import org.msgpack.annotation.Message; @Message public class Proposal { private String proposerName = ""; private String acceptorName = ""; private int acceptorNum = 0; private int nodeNum = 0; private int number = 0; private int value = 0; private int id = 0; private int round = 0; private boolean accepted = false; public Proposal(){ } public Proposal(String proposerName, int nodeNum, int value, int id, int acceptorNum){ this.proposerName = proposerName; this.nodeNum = nodeNum; this.value = value; this.id = id; this.acceptorNum = acceptorNum; incrementNumber(); } public void setValue(int value){ this.value = value; } public int getValue(){ return this.value; } public void setNumber(int number) { this.number = number; } public int getNumber(){ return this.number; } public int incrementRound(){ this.round += 1; return this.round; } public int incrementNumber() { this.number = incrementRound() * nodeNum + id; return this.number; } public int getAcceptorNum(){ return this.acceptorNum; } public String getProposerName() { return proposerName; } public boolean isAccepted() { return accepted; } public void setAccepted(boolean accepted) { this.accepted = accepted; } public String getAcceptorName() { return acceptorName; } public void setAcceptorName(String acceptorName) { this.acceptorName = acceptorName; } public boolean equalValue(Proposal proposal){ return this.equalValue(proposal.value); } public boolean equalValue(int value){ if(this.value == value) return true; return false; } }