summaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2008-05-25 09:03:33 +0000
committerPaul Buetow <paul@buetow.org>2008-05-25 09:03:33 +0000
commit009350323123fc4b47041cb2194e8df19f69423b (patch)
treea9562cf215181a03137d5281d49d26e0fe5a3b45 /sources
parentbb1dbccae485263ea5182546006339870c57b367 (diff)
Run astyle.
Diffstat (limited to 'sources')
-rw-r--r--sources/core/VSMessage.java40
-rw-r--r--sources/core/VSProcess.java148
-rw-r--r--sources/core/VSTask.java56
-rw-r--r--sources/core/VSTaskManager.java40
-rw-r--r--sources/core/time/VSLamportTime.java12
-rw-r--r--sources/core/time/VSTime.java8
-rw-r--r--sources/core/time/VSVectorTime.java12
-rw-r--r--sources/events/VSEvent.java30
-rw-r--r--sources/events/VSRegisteredEvents.java44
-rw-r--r--sources/events/implementations/ProcessCrashEvent.java2
-rw-r--r--sources/events/implementations/ProcessRecoverEvent.java2
-rw-r--r--sources/events/internal/MessageReceiveEvent.java4
-rw-r--r--sources/events/internal/ProtocolEvent.java16
-rw-r--r--sources/prefs/VSDefaultPrefs.java10
-rw-r--r--sources/prefs/VSPrefs.java250
-rw-r--r--sources/prefs/editors/VSBetterEditor.java20
-rw-r--r--sources/prefs/editors/VSColorChooser.java14
-rw-r--r--sources/prefs/editors/VSEditor.java126
-rw-r--r--sources/prefs/editors/VSEditorFrame.java8
-rw-r--r--sources/prefs/editors/VSEditorTable.java40
-rw-r--r--sources/prefs/editors/VSProcessEditor.java8
-rw-r--r--sources/prefs/editors/VSSimulatorEditor.java12
-rw-r--r--sources/protocols/VSProtocol.java32
-rw-r--r--sources/protocols/implementations/BerkelyTimeProtocol.java4
-rw-r--r--sources/protocols/implementations/BroadcastSturmProtocol.java4
-rw-r--r--sources/protocols/implementations/DummyProtocol.java2
-rw-r--r--sources/protocols/implementations/ExternalTimeSyncProtocol.java4
-rw-r--r--sources/protocols/implementations/InternalTimeSyncProtocol.java2
-rw-r--r--sources/protocols/implementations/PingPongProtocol.java4
-rw-r--r--sources/simulator/VSAbout.java8
-rw-r--r--sources/simulator/VSLogging.java32
-rw-r--r--sources/simulator/VSMain.java10
-rw-r--r--sources/simulator/VSSimulator.java208
-rw-r--r--sources/simulator/VSSimulatorCanvas.java218
-rw-r--r--sources/simulator/VSSimulatorFrame.java48
-rw-r--r--sources/utils/VSClassLoader.java6
-rw-r--r--sources/utils/VSFrame.java16
-rw-r--r--sources/utils/VSInfoArea.java6
-rw-r--r--sources/utils/VSPriorityQueue.java8
-rw-r--r--sources/utils/VSRandom.java10
-rw-r--r--sources/utils/VSTools.java12
-rw-r--r--sources/utils/VSTupel.java14
42 files changed, 775 insertions, 775 deletions
diff --git a/sources/core/VSMessage.java b/sources/core/VSMessage.java
index 2be91bf..ff442c7 100644
--- a/sources/core/VSMessage.java
+++ b/sources/core/VSMessage.java
@@ -12,31 +12,31 @@ import prefs.VSPrefs;
* This class represents a message which is send from one process to another process in the simulation.
*/
public class VSMessage extends VSPrefs {
-
+
/** Each message belongs to a specific protocol. This variable defined the class name of the protocol being used. */
private String protocolClassname;
-
+
/** The default application preferences. */
private VSPrefs prefs;
-
+
/** A reference to the process who sent this message. */
private VSProcess sendingProcess;
-
+
/** The vector time of the sending process after sending. The receiver process will use this vector time in order to update the local vector time. */
private VSVectorTime vectorTime;
-
+
/** The lamport time of the sending process after sending. The receiver process will use this lamport time in order to update the local vector time. */
private long lamportTime;
-
+
/** Each message has its own unique ID. The ID will show up in the logging window of the simulator as well. */
private long messageID;
-
+
/** This counter is used in order to generate unique message ID's. */
private static long messageCounter;
/**
* The constructor of the message.
- *
+ *
* @param protocolClassname The classname of the protocol this message
* belongs to.
*/
@@ -47,7 +47,7 @@ public class VSMessage extends VSPrefs {
/**
* Initialized the message.
- *
+ *
* @param process The sending process of this message.
*/
public void init(VSProcess process) {
@@ -59,7 +59,7 @@ public class VSMessage extends VSPrefs {
/**
* Getter method.
- *
+ *
* @return The protocol name of the message.
*/
public String getName() {
@@ -68,7 +68,7 @@ public class VSMessage extends VSPrefs {
/**
* Getter method.
- *
+ *
* @return The protocol classname of the message.
*/
public String getProtocolClassname() {
@@ -77,7 +77,7 @@ public class VSMessage extends VSPrefs {
/**
* Getter method.
- *
+ *
* @return The ID of the message.
*/
public long getMessageID() {
@@ -86,7 +86,7 @@ public class VSMessage extends VSPrefs {
/**
* Getter method.
- *
+ *
* @return The process which sent this message.
*/
public VSProcess getSendingProcess() {
@@ -95,7 +95,7 @@ public class VSMessage extends VSPrefs {
/**
* Getter method.
- *
+ *
* @return The lamport time of the sending process.
*/
public long getLamportTime() {
@@ -104,7 +104,7 @@ public class VSMessage extends VSPrefs {
/**
* Getter method.
- *
+ *
* @return The vector time of the sending process.
*/
public VSVectorTime getVectorTime() {
@@ -113,7 +113,7 @@ public class VSMessage extends VSPrefs {
/**
* String representation of the message object.
- *
+ *
* @return String representation of the message object.
*/
public String toString() {
@@ -131,7 +131,7 @@ public class VSMessage extends VSPrefs {
/**
* Extended string representation of the message object.
- *
+ *
* @return Extended string representation of the message object.
*/
public String toStringFull() {
@@ -140,9 +140,9 @@ public class VSMessage extends VSPrefs {
/**
* Compares two messages.
- *
+ *
* @param message The message to compare with.
- *
+ *
* @return true, if the messages have the same ID. Otherwise false.
*/
public boolean equals(VSMessage message) {
@@ -151,7 +151,7 @@ public class VSMessage extends VSPrefs {
/**
* For logging in the simulator's logging window!.
- *
+ *
* @param message The message to logg.
*/
public void logg(String message) { }
diff --git a/sources/core/VSProcess.java b/sources/core/VSProcess.java
index e4c7561..047b68d 100644
--- a/sources/core/VSProcess.java
+++ b/sources/core/VSProcess.java
@@ -19,85 +19,85 @@ import utils.*;
* The Class VSProcess. A object of this class represents a process of a simulation.
*/
public class VSProcess extends VSPrefs {
-
+
/** The protocols to reset if the simulation is over or the reset button has been pressed. */
private ArrayList<VSProtocol> protocolsToReset;
-
+
/** The crash history. represents all crashes of the process using the global simulation time. */
private ArrayList<Long> crashHistory;
-
+
/** The lamport time history. */
private ArrayList<VSLamportTime> lamportTimeHistory;
-
+
/** The vector time history. */
private ArrayList<VSVectorTime> vectorTimeHistory;
-
+
/** The crashed color. */
private Color crashedColor;;
-
+
/** The current color. */
private Color currentColor;
-
+
/** The tmp color. For internal usage. */
private Color tmpColor;
-
+
/** The logging object. */
private VSLogging logging;
-
+
/** The simulation's default prefs. */
private VSPrefs prefs;
-
+
/** The random generator of the process. */
private VSRandom random;
-
+
/** The simulation canvas. */
private VSSimulatorCanvas simulationCanvas;
-
+
/** The random crash task. May be null if there is no such random task. */
private VSTask randomCrashTask;
-
+
/** The vector time. */
private VSVectorTime vectorTime;
-
+
/** The process has crashed. But may be working again. */
private boolean hasCrashed;
-
+
/** The process has started. But may be paused or crashed.. */
private boolean hasStarted;
-
+
/** The process is crashed. */
private boolean isCrashed;
-
+
/** The process is highlighted. */
private boolean isHighlighted;
-
+
/** The process is paused. */
private boolean isPaused;
-
+
/** The time has been modified in a task. Needed by the task manager to calculate correct offsets. */
private boolean timeModified;
-
+
/** The clock offset. Used by the task manager and also by the process' clock variance. */
private double clockOffset;
-
+
/** The clock variance. */
private float clockVariance;
-
+
/** The process id. */
private int processID; // Represents the PID of a process
-
+
/** The process num. It is different to the process id. It represents the array index of the process. */
private int processNum; // Represents the array index of the process, for internal usage
-
+
/** The global time. */
private long globalTime;
-
+
/** The lamport time. */
private long lamportTime;
-
+
/** The local time. */
private long localTime;
-
+
/** The process counter. Needed for the unique process id's. */
private static int processCounter;
@@ -153,7 +153,7 @@ public class VSProcess extends VSPrefs {
/**
* Instantiates a new process.
- *
+ *
* @param prefs the simulation's default prefs
* @param processNum the process num
* @param simulationCanvas the simulation canvas
@@ -240,7 +240,7 @@ public class VSProcess extends VSPrefs {
/**
* Sync time. Using the clockOffset and clockVariance.
- *
+ *
* @param globalTime the global time
*/
public synchronized void syncTime(final long globalTime) {
@@ -266,7 +266,7 @@ public class VSProcess extends VSPrefs {
/**
* Sets the current color.
- *
+ *
* @param newColor the new current color
*/
private void setCurrentColor(Color newColor) {
@@ -340,7 +340,7 @@ public class VSProcess extends VSPrefs {
/**
* Adds the clock offset. This method is used by the task manager.
- *
+ *
* @param add the clock offset to add.
*/
public synchronized void addClockOffset(long add) {
@@ -373,7 +373,7 @@ public class VSProcess extends VSPrefs {
/**
* Gets the process id.
- *
+ *
* @return the process id
*/
public synchronized int getProcessID() {
@@ -382,7 +382,7 @@ public class VSProcess extends VSPrefs {
/**
* Gets the process num.
- *
+ *
* @return the process num
*/
public synchronized int getProcessNum() {
@@ -391,7 +391,7 @@ public class VSProcess extends VSPrefs {
/**
* Sets the process id.
- *
+ *
* @param processID the new process id
*/
public synchronized void setProcessID(int processID) {
@@ -400,7 +400,7 @@ public class VSProcess extends VSPrefs {
/**
* Gets the current process' color.
- *
+ *
* @return the current color of the process.
*/
public synchronized Color getColor() {
@@ -409,7 +409,7 @@ public class VSProcess extends VSPrefs {
/**
* Sets the local time.
- *
+ *
* @param localTime the new local time.
*/
public synchronized void setLocalTime(final long localTime) {
@@ -421,7 +421,7 @@ public class VSProcess extends VSPrefs {
/**
* Gets the process' local time.
- *
+ *
* @return the process' local time
*/
public synchronized long getTime() {
@@ -430,7 +430,7 @@ public class VSProcess extends VSPrefs {
/**
* Sets the process' local time.
- *
+ *
* @param time the new local time of the process.
*/
public synchronized void setTime(final long time) {
@@ -444,7 +444,7 @@ public class VSProcess extends VSPrefs {
/**
* Checks if the process is crashed.
- *
+ *
* @return true, if is crashed
*/
public synchronized boolean isCrashed() {
@@ -452,8 +452,8 @@ public class VSProcess extends VSPrefs {
}
/**
- * Sets if the process is crashed.
- *
+ * Sets if the process is crashed.
+ *
* @param isCrashed true if the process is crashed.
*/
public synchronized void isCrashed(boolean isCrashed) {
@@ -466,7 +466,7 @@ public class VSProcess extends VSPrefs {
/**
* Checks if the process has crashed at least once during the current
* simulation.
- *
+ *
* @return true, if yes
*/
public synchronized boolean hasCrashed() {
@@ -475,7 +475,7 @@ public class VSProcess extends VSPrefs {
/**
* Gets the crashed color.
- *
+ *
* @return the crashed color
*/
public synchronized Color getCrashedColor() {
@@ -483,9 +483,9 @@ public class VSProcess extends VSPrefs {
}
/**
- * Checks if the time has been modified. by a task.
+ * Checks if the time has been modified. by a task.
* This mehod is needed by the task manager.
- *
+ *
* @return true, if yes
*/
public synchronized boolean timeModified() {
@@ -494,7 +494,7 @@ public class VSProcess extends VSPrefs {
/**
* Sets if the time has been modified by a task.
- *
+ *
* @param timeModified true, if it has been modified.
*/
public synchronized void timeModified(boolean timeModified) {
@@ -503,7 +503,7 @@ public class VSProcess extends VSPrefs {
/**
* Gets the global time.
- *
+ *
* @return the global time
*/
public synchronized long getGlobalTime() {
@@ -512,7 +512,7 @@ public class VSProcess extends VSPrefs {
/**
* Sets the global time.
- *
+ *
* @param globalTime the new global time
*/
public synchronized void setGlobalTime(final long globalTime) {
@@ -521,7 +521,7 @@ public class VSProcess extends VSPrefs {
/**
* Gets the clock variance.
- *
+ *
* @return the clock variance
*/
public synchronized float getClockVariance() {
@@ -530,7 +530,7 @@ public class VSProcess extends VSPrefs {
/**
* Sets the clock variance.
- *
+ *
* @param clockVariance the new clock variance
*/
public synchronized void setClockVariance(float clockVariance) {
@@ -548,7 +548,7 @@ public class VSProcess extends VSPrefs {
/**
* Gets the duration time.
- *
+ *
* @return the duration time
*/
public synchronized long getDurationTime() {
@@ -569,9 +569,9 @@ public class VSProcess extends VSPrefs {
/**
* Gets the a random message outage time.
- *
+ *
* @param durationTime the duration time
- *
+ *
* @return the a random message outage time
*/
public synchronized long getARandomMessageOutageTime(final long durationTime) {
@@ -588,7 +588,7 @@ public class VSProcess extends VSPrefs {
/**
* Gets the a random crash time.
- *
+ *
* @return the a random crash time
*/
private long getARandomCrashTime() {
@@ -605,7 +605,7 @@ public class VSProcess extends VSPrefs {
/**
* Gets the random crash task.
- *
+ *
* @return the random crash task
*/
public synchronized VSTask getCrashTask() {
@@ -614,7 +614,7 @@ public class VSProcess extends VSPrefs {
/**
* Checks if is paused.
- *
+ *
* @return true, if is paused
*/
public synchronized boolean isPaused() {
@@ -630,7 +630,7 @@ public class VSProcess extends VSPrefs {
/**
* Updates the lamport time.
- *
+ *
* @param time the lamport time
*/
public void updateLamportTime(long time) {
@@ -644,7 +644,7 @@ public class VSProcess extends VSPrefs {
/**
* Gets the lamport time.
- *
+ *
* @return the lamport time.
*/
public synchronized long getLamportTime() {
@@ -653,7 +653,7 @@ public class VSProcess extends VSPrefs {
/**
* Sets the lamport time.
- *
+ *
* @param lamportTime the new lamport time
*/
public synchronized void setLamportTime(long lamportTime) {
@@ -663,7 +663,7 @@ public class VSProcess extends VSPrefs {
/**
* Gets the lamport time history as an array.
- *
+ *
* @return the lamport time history array
*/
public synchronized VSTime[] getLamportTimeArray() {
@@ -687,7 +687,7 @@ public class VSProcess extends VSPrefs {
/**
* Updates the vector time.
- *
+ *
* @param vectorTimeUpdate the vector time of the other process to use for the update
*/
public synchronized void updateVectorTime(VSVectorTime vectorTimeUpdate) {
@@ -706,7 +706,7 @@ public class VSProcess extends VSPrefs {
/**
* Gets the vector time.
- *
+ *
* @return the vector time
*/
public synchronized VSVectorTime getVectorTime() {
@@ -715,7 +715,7 @@ public class VSProcess extends VSPrefs {
/**
* Gets the vector time history as an array.
- *
+ *
* @return the vector time history array
*/
public synchronized VSTime[] getVectorTimeArray() {
@@ -730,7 +730,7 @@ public class VSProcess extends VSPrefs {
/**
* Gets the crash history array.
- *
+ *
* @return the crash history array
*/
public synchronized Long[] getCrashHistoryArray() {
@@ -745,7 +745,7 @@ public class VSProcess extends VSPrefs {
/**
* Called by a task if the process sends a message.
- *
+ *
* @param message the message to send.
*/
public void sendMessage(VSMessage message) {
@@ -759,7 +759,7 @@ public class VSProcess extends VSPrefs {
/**
* Logg a message to the logging area.
- *
+ *
* @param message the message to logg
*/
public void logg(String message) {
@@ -802,7 +802,7 @@ public class VSProcess extends VSPrefs {
/**
* The extended string representation of the process object.
- *
+ *
* @return the extended string representation
*/
public String toStringFull() {
@@ -819,9 +819,9 @@ public class VSProcess extends VSPrefs {
/**
* Equals. Checks, if both processes have the same process id.
- *
+ *
* @param process the process to compare to
- *
+ *
* @return true, if both processes are the same.
*/
public boolean equals(VSProcess process) {
@@ -830,7 +830,7 @@ public class VSProcess extends VSPrefs {
/**
* Gets the simulation canvas.
- *
+ *
* @return the simulation canvas
*/
public VSSimulatorCanvas getSimulationCanvas() {
@@ -839,7 +839,7 @@ public class VSProcess extends VSPrefs {
/**
* Gets the simulation's default prefs.
- *
+ *
* @return the default prefs
*/
public VSPrefs getPrefs() {
@@ -856,7 +856,7 @@ public class VSProcess extends VSPrefs {
/**
* Removes the process at the specified index.
* Needed in order to update the vector time and the local processNum.
- *
+ *
* @param index the index the process has to get removed.
*/
public void removeProcessAtIndex(int index) {
@@ -879,9 +879,9 @@ public class VSProcess extends VSPrefs {
/**
* Gets the protocol object.
- *
+ *
* @param protocolClassname the protocol classname
- *
+ *
* @return the protocol object
*/
public VSProtocol getProtocolObject(String protocolClassname) {
diff --git a/sources/core/VSTask.java b/sources/core/VSTask.java
index 8e6bd34..774dd7d 100644
--- a/sources/core/VSTask.java
+++ b/sources/core/VSTask.java
@@ -17,40 +17,40 @@ import protocols.VSProtocol;
* Global timed tasks are being fullfilled if the simulation's time is reached.
*/
public class VSTask implements Comparable {
-
+
/** The Constant LOCAL. Used for the constructor if it's a local timed task. */
public final static boolean LOCAL = true;
-
+
/** The Constant GLOBAL. Used for the constructor if it's a global timed task. */
public final static boolean GLOBAL = false;
-
+
/** The task time. */
private long taskTime;
-
+
/** The event. */
private VSEvent event;
-
+
/** The process. */
private VSProcess process;
-
+
/** The prefs. */
private VSPrefs prefs;
-
+
/** The task is programmed. The task will be still in the task manager after reset. */
private boolean isProgrammed;
-
+
/** The task is global timed. If set to true, its local timed. */
private boolean isGlobalTimed;
-
+
/** The task counter. Needed for the unique task numbers. */
private static int taskCounter;
-
+
/** The task number. */
private int taskNum;
/**
* Instantiates a new task.
- *
+ *
* @param taskTime the task time
* @param process the process
* @param event the event
@@ -67,7 +67,7 @@ public class VSTask implements Comparable {
/**
* Gets the task num.
- *
+ *
* @return the task num
*/
public int getTaskNum() {
@@ -76,7 +76,7 @@ public class VSTask implements Comparable {
/**
* Checks if is programmed.
- *
+ *
* @param isProgrammed the task is programmed
*/
public void isProgrammed(boolean isProgrammed) {
@@ -85,7 +85,7 @@ public class VSTask implements Comparable {
/**
* Checks if the task is programmed.
- *
+ *
* @return true, if the task is programmed
*/
public boolean isProgrammed() {
@@ -94,7 +94,7 @@ public class VSTask implements Comparable {
/**
* Checks if the task is a message receive event.
- *
+ *
* @return true, if it is a message receive event
*/
public boolean isMessageReceiveEvent() {
@@ -103,7 +103,7 @@ public class VSTask implements Comparable {
/**
* Checks if the task is a process recover event.
- *
+ *
* @return true, if it is a process recover event
*/
public boolean isProcessRecoverEvent() {
@@ -112,9 +112,9 @@ public class VSTask implements Comparable {
/**
* Checks if the task belongs to the specified protocol object.
- *
+ *
* @param protocol the protocol object to check against.
- *
+ *
* @return true, if it's a task using the protocol object.
*/
public boolean isProtocol(VSProtocol protocol) {
@@ -126,7 +126,7 @@ public class VSTask implements Comparable {
/**
* Time over. The task's time is over.
- *
+ *
* @return true, if it's over
*/
public boolean timeOver() {
@@ -138,9 +138,9 @@ public class VSTask implements Comparable {
/**
* Checks if the task equals to another task.
- *
+ *
* @param task the task to compare to
- *
+ *
* @return true, if equal
*/
public boolean equals(VSTask task) {
@@ -149,9 +149,9 @@ public class VSTask implements Comparable {
/**
* Checks if the event belongs to the specified process.
- *
+ *
* @param process the process to check against
- *
+ *
* @return true, if the event is using the process
*/
public boolean isProcess(VSProcess process) {
@@ -160,7 +160,7 @@ public class VSTask implements Comparable {
/**
* Checks if the task is global timed.
- *
+ *
* @return true, if the taks is global timed
*/
public boolean isGlobalTimed() {
@@ -169,7 +169,7 @@ public class VSTask implements Comparable {
/**
* Gets the process.
- *
+ *
* @return the process of the event
*/
public VSProcess getProcess() {
@@ -187,7 +187,7 @@ public class VSTask implements Comparable {
/**
* Gets the task time.
- *
+ *
* @return the task time
*/
public long getTaskTime() {
@@ -196,7 +196,7 @@ public class VSTask implements Comparable {
/**
* Gets the event.
- *
+ *
* @return the event
*/
public VSEvent getEvent() {
@@ -205,7 +205,7 @@ public class VSTask implements Comparable {
/**
* Logg a message.
- *
+ *
* @param message the message to logg
*/