summaryrefslogtreecommitdiff
path: root/sources/protocols/VSAbstractProtocol.java
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2008-06-11 09:48:10 +0000
committerPaul Buetow <paul@buetow.org>2008-06-11 09:48:10 +0000
commit0e2e70d5a393024f3ae4a3a3560b4df51075000a (patch)
tree27c659d282bec3508304d5fa80a34a1662185950 /sources/protocols/VSAbstractProtocol.java
parent412a1ac0e6311fe39452ae41b6eada4ef17cce34 (diff)
More javadoc.
Several bugfixes. New feauture: Boolean: sim.periodic A lot of more which i forgot!
Diffstat (limited to 'sources/protocols/VSAbstractProtocol.java')
-rw-r--r--sources/protocols/VSAbstractProtocol.java37
1 files changed, 24 insertions, 13 deletions
diff --git a/sources/protocols/VSAbstractProtocol.java b/sources/protocols/VSAbstractProtocol.java
index 39d338a..7c3cd2e 100644
--- a/sources/protocols/VSAbstractProtocol.java
+++ b/sources/protocols/VSAbstractProtocol.java
@@ -33,7 +33,10 @@ import serialize.*;
import utils.*;
/**
- * The class VSAbstractProtocol.
+ * The class VSAbstractProtocol, this class defined the basic framework of a
+ * protocol.
+ *
+ * @author Paul C. Buetow
*/
abstract public class VSAbstractProtocol extends VSAbstractEvent {
/** The serial version uid */
@@ -69,12 +72,18 @@ abstract public class VSAbstractProtocol extends VSAbstractEvent {
/** The protocol's client schedules */
private ArrayList<VSTask> clientSchedules = new ArrayList<VSTask>();
+ /**
+ * A simple constructor.
+ *
+ * @param hasOnServerStart true, if the protocol uses an onServerStart
+ * method. false, if the protocol uses an onClientStart method instead.
+ */
public VSAbstractProtocol(boolean hasOnServerStart) {
this.hasOnServerStart = hasOnServerStart;
}
/**
- * Send a message.
+ * Sends a message.
*
* @param message the message to send
*/
@@ -223,7 +232,8 @@ abstract public class VSAbstractProtocol extends VSAbstractEvent {
/**
* Checks how the protocol will start
*
- * @return true, if this protocol uses onServerStart instead of onClientStart
+ * @return true, if this protocol uses onServerStart instead of
+ * onClientStart
*/
public final boolean hasOnServerStart() {
return hasOnServerStart;
@@ -266,32 +276,31 @@ abstract public class VSAbstractProtocol extends VSAbstractEvent {
}
/**
- * Reset.
+ * Resets the protocol.
*/
public void reset() {
- //if (isServer) {
currentContextIsServer(true);
isServer = false;
onServerReset();
serverSchedules.clear();
- //}
- //if (isClient) {
currentContextIsServer(false);
isClient = false;
onClientReset();
clientSchedules.clear();
- //}
}
/**
- * Reschedules the protocol for a new time and runs onClientSchedule or onServerSchedule
+ * Reschedules the protocol for a new time and runs onClientSchedule or
+ * onServerSchedule
*
* @param time The process' local time to run the schedule at.
*/
public final void scheduleAt(long time) {
- VSAbstractEvent scheduleEvent = new VSProtocolScheduleEvent(this, currentContextIsServer);
- VSTask scheduleTask = new VSTask(time, process, scheduleEvent, VSTask.LOCAL);
+ VSAbstractEvent scheduleEvent =
+ new VSProtocolScheduleEvent(this, currentContextIsServer);
+ VSTask scheduleTask =
+ new VSTask(time, process, scheduleEvent, VSTask.LOCAL);
if (currentContextIsServer)
serverSchedules.add(scheduleTask);
else
@@ -304,10 +313,12 @@ abstract public class VSAbstractProtocol extends VSAbstractEvent {
*/
public final void removeSchedules() {
if (currentContextIsServer) {
- process.getSimulatorCanvas().getTaskManager().removeAllTasks(serverSchedules);
+ process.getSimulatorCanvas().
+ getTaskManager().removeAllTasks(serverSchedules);
serverSchedules.clear();
} else {
- process.getSimulatorCanvas().getTaskManager().removeAllTasks(clientSchedules);
+ process.getSimulatorCanvas().
+ getTaskManager().removeAllTasks(clientSchedules);
clientSchedules.clear();
}
}