1 package org
.eclipse
.linuxtools
.lttng
.event
;
3 import org
.eclipse
.linuxtools
.tmf
.trace
.ITmfLocation
;
6 public class LttngLocation
implements ITmfLocation
{
8 private final static Long DEFAULT_LAST_TIME
= -1L;
9 private final static Long DEFAULT_CURR_TIME
= 0L;
11 private Long lastReadTime
= null;
12 private Long currentTime
= null;
16 public LttngLocation() {
17 this(DEFAULT_LAST_TIME
, DEFAULT_CURR_TIME
);
20 // public LttngLocation(LttngTimestamp timestamp) {
21 // this(DEFAULT_LAST_TIME, timestamp.getValue());
24 public LttngLocation(LttngLocation oldLocation
) {
25 this(oldLocation
.lastReadTime
, oldLocation
.currentTime
);
28 public LttngLocation(Long newCurrentTimestamp
) {
29 this(DEFAULT_LAST_TIME
, newCurrentTimestamp
);
32 public LttngLocation(Long newLastReadTime
, Long newCurrentTimestamp
) {
33 lastReadTime
= newLastReadTime
;
34 currentTime
= newCurrentTimestamp
;
38 public LttngLocation
clone() {
40 LttngLocation newLocation
= null;
43 newLocation
= (LttngLocation
)super.clone();
46 // Basic type in java are immutable!
47 // Thus, using assignation ("=") on basic type is VALID.
48 newLocation
.currentTime
= this.currentTime
;
49 newLocation
.lastReadTime
= this.lastReadTime
;
51 catch (CloneNotSupportedException e
) {
52 System
.out
.println("Cloning failed with : " + e
.getMessage());
59 public void resetLocation() {
60 resetLocation(DEFAULT_CURR_TIME
);
63 public void resetLocation(Long newCurrentTimestamp
) {
64 lastReadTime
= DEFAULT_LAST_TIME
;
65 lastReadTime
= DEFAULT_CURR_TIME
;
70 public Long
getLastReadTime() {
74 public void setLastReadTime(Long newLastReadTime
) {
75 this.lastReadTime
= newLastReadTime
;
78 public Long
getCurrentTime() {
82 public void setCurrentTime(Long newCurrentTime
) {
83 this.currentTime
= newCurrentTime
;
88 public String
toString() {
89 return "\tLttngLocation[ Last : " + lastReadTime
+ " Current : " + currentTime
+ " ]";