public void handleMessage(BSPMessage message) { Belief belief = serializer.generateBelief(message.getData().getBuffer()); if (belief.getBeliefType() == Belief.BeliefType.WAYPOINT_PATH) { Log.debug("Received waypoint path"); } repo.Commit(belief); }
private Message formatMessage(BSPMessage data) { if (data == null) { Console.Error.WriteLine("Could not format null data"); return(null); } int messageLength = data.getData().size(); NetworkBuffer messageData = new NetworkBuffer(HEADER_LENGTH + messageLength); messageData.writeInt32(HEADER_TYPE_OFFSET, (int)data.getType()); messageData.writeInt32(HEADER_SOURCE_OFFSET, data.getSourceID()); if (data.getData().size() > 0) { messageData.writeBytes(data.getData().getBuffer(), 0, HEADER_LENGTH, data.getData().size()); } return(new Message(data.getAddress(), messageData.getBuffer())); }
public void handleMessage(BSPMessage message) { RepositoryStateSerializer serializer = new RepositoryStateSerializer(); RepositoryState incomingState = serializer.deserialize(message.getData()); if (incomingState.RevisionNumber() > remoteState.RevisionNumber()) { this.remoteState = incomingState; IEnumerable <CachedBelief> changedBeliefs = repo.Diff(remoteState); foreach (CachedBelief belief in changedBeliefs) { protocol.post(belief); } } }
public void handleMessage(BSPMessage message) { Belief belief = serializer.generateBelief(message.getData().getBuffer()); repo.Commit(belief); }