Passed
Push — master ( 1f3b93...63f895 )
by Alessandro
09:41
created

clear(long,long)   A

Complexity

Conditions 1

Size

Total Lines 6
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
package it.cnr.istc.pst.platinum.ai.framework.time.tn;
2
3
/**
4
 * 
5
 * @author alessandro
6
 *
7
 */
8
public class TimePoint extends TemporalData
0 ignored issues
show
Bug introduced by
Override the "equals" method in this class.
Loading history...
9
{
10
	private long domLb;
11
	private long domUb;
12
	
13
	// computed values
14
	private long lb;
15
	private long ub;
16
	private double execTime;
17
	
18
	/**
19
	 * 
20
	 * @param id
21
	 * @param lb
22
	 * @param ub
23
	 */
24
	protected TimePoint(int id, long lb, long ub) {
25
		super(id);
26
		this.domLb = lb;
27
		this.domUb = ub;
28
		// initialize data
29
		this.lb = this.domLb;
30
		this.ub = this.domUb;
31
	}
32
	
33
	/**
34
	 * 
35
	 * @param lb
36
	 * @param ub
37
	 */
38
	public void clear(long lb, long ub) {
39
		this.domLb = lb;
40
		this.domUb = ub;
41
		this.lb = this.domLb;
42
		this.ub = this.domUb;
43
		this.execTime = 0;
44
	}
45
	
46
	/**
47
	 * 
48
	 * @param lb
49
	 */
50
	protected void setDomLb(long lb) {
51
		this.domLb = lb;
52
	}
53
	
54
	/**
55
	 * 
56
	 * @param ub
57
	 */
58
	protected void setDomUb(long ub) {
59
		this.domUb = ub;
60
	}
61
	
62
	/**
63
	 * 
64
	 * @return
65
	 */
66
	public long getDomLb() {
67
		return this.domLb;
68
	}
69
	
70
	/**
71
	 * 
72
	 * @return
73
	 */
74
	public long getDomUb() {
75
		return this.domUb;
76
	}
77
	
78
	/**
79
	 * 
80
	 * @param lb
81
	 */
82
	public void setLowerBound(long lb) {
83
		this.lb = lb;
84
	}
85
	
86
	/**
87
	 * 
88
	 * @return
89
	 */
90
	public long getLowerBound() {
91
		return lb;
92
	}
93
	
94
	/**
95
	 * 
96
	 * @param ub
97
	 */
98
	public void setUpperBound(long ub) {
99
		this.ub = ub;
100
	}
101
	
102
	/**
103
	 * 
104
	 * @return
105
	 */
106
	public long getUpperBound() {
107
		return ub;
108
	}
109
	
110
	/**
111
	 * 
112
	 * @param execTime
113
	 */
114
	public void setExecTime(double execTime) {
115
		this.execTime = execTime;
116
	}
117
	
118
	/**
119
	 * 
120
	 * @return
121
	 */
122
	public double getExecTime() {
123
		return execTime;
124
	}
125
	
126
	/**
127
	 * 
128
	 * @return
129
	 */
130
	public TimePoint clone() {
0 ignored issues
show
Coding Style Code Smell introduced by
You should use super.clone() to create and seed the cloned instance to be returned.
Loading history...
introduced by
Remove this "clone" implementation; use a copy constructor or copy factory instead.
Loading history...
131
		TimePoint clone = new TimePoint(this.id, this.domLb, this.domUb);
132
		clone.setLowerBound(this.lb);
133
		clone.setUpperBound(this.ub);
134
		clone.setExecTime(this.execTime);
135
		return clone;
136
	}
137
	
138
	/**
139
	 * 
140
	 */
141
	@Override
142
	public int compareTo(TemporalData o) {
143
		// get time point 
144
		TimePoint p = (TimePoint) o;
145
		return this.lb < p.lb ? -1 : this.lb == p.lb && this.ub < p.ub ? -1 : 
146
			this.lb == p.lb && this.ub == p.ub ? 0 : 1;
147
	}
148
	
149
	/**
150
	 * 
151
	 */
152
	@Override
153
	public String toString() {
154
		return "[TimePoint id=" + this.id + ", lb= " + this.lb + ", ub= " + this.ub + "]";
155
	}
156
}
157