summaryrefslogtreecommitdiff
path: root/sources/core/time
diff options
context:
space:
mode:
Diffstat (limited to 'sources/core/time')
-rw-r--r--sources/core/time/VSLamportTime.java23
-rw-r--r--sources/core/time/VSTime.java10
-rw-r--r--sources/core/time/VSVectorTime.java1
3 files changed, 33 insertions, 1 deletions
diff --git a/sources/core/time/VSLamportTime.java b/sources/core/time/VSLamportTime.java
index 704b3d5..592507a 100644
--- a/sources/core/time/VSLamportTime.java
+++ b/sources/core/time/VSLamportTime.java
@@ -1,22 +1,45 @@
package core.time;
+/** This class defined how the lamport timestamps are represented.
+ */
public class VSLamportTime implements VSTime {
+ /** Specified the global time of the lamport timestamp. It's used for correct painting in the simulator paint area.
+ */
private long globalTime;
+ /** Specified the process' local lamport time.
+ */
private long lamportTime;
+ /** A simple constructor.
+ *
+ * @param globalTime The global time.
+ * @param lamportTime The local lamport time.
+ */
public VSLamportTime(long globalTime, long lamportTime) {
this.globalTime = globalTime;
this.lamportTime = lamportTime;
}
+ /** Getter method.
+ *
+ * @return The global time.
+ */
public long getGlobalTime() {
return globalTime;
}
+ /** Getter method.
+ *
+ * @return The process' local lamport time.
+ */
public long getLamportTime() {
return lamportTime;
}
+ /** String representation.
+ *
+ * @return The string representation of the lamport time.
+ */
public String toString() {
return "(" + lamportTime + ")";
}
diff --git a/sources/core/time/VSTime.java b/sources/core/time/VSTime.java
index efeda52..ce20ecc 100644
--- a/sources/core/time/VSTime.java
+++ b/sources/core/time/VSTime.java
@@ -1,6 +1,16 @@
package core.time;
+/** This interface is a guidline for general time format classes.
+ */
public interface VSTime {
+ /** Getter method.
+ *
+ * @return The global time.
+ */
public long getGlobalTime();
+ /** String representation.
+ *
+ * @return The representation of the implementing object as a string.
+ */
public String toString();
}
diff --git a/sources/core/time/VSVectorTime.java b/sources/core/time/VSVectorTime.java
index 7d0f371..eb6c0aa 100644
--- a/sources/core/time/VSVectorTime.java
+++ b/sources/core/time/VSVectorTime.java
@@ -3,7 +3,6 @@ package core.time;
import java.util.ArrayList;
public class VSVectorTime extends ArrayList<Long> implements VSTime {
- /* Only needed for painting in the painting panel */
private long globalTime;
public VSVectorTime(long globalTime) {