From 9f0d5c8015f4504bc8400cbb4247f38d9df62768 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 24 May 2008 16:47:25 +0000 Subject: new protocol editor works. --- sources/protocols/VSProtocol.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'sources/protocols/VSProtocol.java') diff --git a/sources/protocols/VSProtocol.java b/sources/protocols/VSProtocol.java index 291b778..e13fe2e 100644 --- a/sources/protocols/VSProtocol.java +++ b/sources/protocols/VSProtocol.java @@ -10,6 +10,9 @@ abstract public class VSProtocol extends VSEvent { private boolean currentContextIsServer; protected void sendMessage(VSMessage message) { + if (process == null) + return; + process.increaseLamportTime(); process.increaseVectorTime(); message.init(process); @@ -72,10 +75,16 @@ abstract public class VSProtocol extends VSEvent { abstract protected void onServerRecv(VSMessage message); protected int getNumProcesses() { + if (process == null) + return 0; + return process.getSimulationCanvas().getNumProcesses(); } public String toString() { + if (process == null) + return ""; + StringBuffer buffer = new StringBuffer(); buffer.append(prefs.getString("lang.protocol")); -- cgit v1.2.3