summaryrefslogtreecommitdiff
path: root/sources/core/time/VSLamportTime.java
blob: c3b138b200a60665d55b501d5b2dd809b83a8ba6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
 * VS is (c) 2008 by Paul C. Buetow
 * vs@dev.buetow.org
 */
package core.time;

// TODO: Auto-generated Javadoc
/**
 * 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 + ")";
    }
}