Test Setup Failed
Push — master ( bb3bf3...1e7564 )
by Alessandro
17:55
created

TokenDescription(String,String,String[],long[])   A

Complexity

Conditions 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
package it.cnr.istc.pst.platinum.control.lang;
2
3
/**
4
 * 
5
 * @author alessandro
6
 *
7
 */
8
public class TokenDescription {
9
	
10
	private String component;				// name of the component the goal refers to 
11
	private String value;					// temporal predicate of the component the goal refers to
12
	private String[] labels;				// labels of the parameters of the predicate
13
	private long[] start;					// start time flexible interval
14
	private long[] end;						// end time flexible interval
15
	private long[] duration;				// duration flexible interval
16
	
17
	
18
	
19
	/**
20
	 * 
21
	 * @param component
22
	 * @param value
23
	 */
24
	public TokenDescription(String component, String value) {
25
		this.component = component;
26
		this.value = value;
27
		this.labels = null;
28
		this.start = null;
29
		this.end = null;
30
		this.duration = null;
31
	}
32
	
33
	/**
34
	 * 
35
	 * @param component
36
	 * @param value
37
	 * @param labels
38
	 */
39
	public TokenDescription(String component, String value, String[] labels) {
40
		this(component, value);
41
		this.labels = labels;
42
	}
43
44
	/**
45
	 * 
46
	 * @param component
47
	 * @param value
48
	 * @param labels
49
	 * @param start
50
	 */
51
	public TokenDescription(String component, String  value, String[] labels, long[] start) {
52
		this(component, value, labels);
53
		this.start = start;
54
	}
55
	
56
	/**
57
	 * 
58
	 * @param component
59
	 * @param value
60
	 * @param labels
61
	 * @param start
62
	 * @param duration
63
	 */
64
	public TokenDescription(String component, String  value, String[] labels, long[] start, long[] duration) {
65
		this(component, value, labels, start);
66
		this.duration = duration;
67
	}
68
	
69
	/**
70
	 * 
71
	 * @param component
72
	 * @param value
73
	 * @param labels
74
	 * @param start
75
	 * @param end
76
	 * @param duration
77
	 */
78
	public TokenDescription(String component, String  value, String[] labels, long[] start, long[] end, long[] duration) {
79
		this(component, value, labels, start, duration);
80
		this.end = end;
81
	}
82
83
	public String getComponent() {
84
		return component;
85
	}
86
87
	public String getValue() {
88
		return value;
89
	}
90
91
	public String[] getLabels() {
92
		return labels;
93
	}
94
95
	public long[] getStart() {
96
		return start;
97
	}
98
99
	public long[] getEnd() {
100
		return end;
101
	}
102
103
	public long[] getDuration() {
104
		return duration;
105
	}
106
	
107
	/**
108
	 * 
109
	 */
110
	@Override
111
	public String toString() {
112
		return "{ "
113
				+ "\"component\": \"" + this.component + "\", "
114
				+ "\"value\": \"" + this.value + "\", "
115
				+ (this.start != null ? "\"start\": [" + this.start[0] + ", " + this.start[1] + "], " : "\"start\": [1, +INF], " )
116
				+ (this.duration != null ? "\"duration\": [" + this.duration[0] + ", " + this.duration[1] + "], " : "\"duration\": [1, +INF], ")
117
				+ (this.end != null ? "\"end\": [" + this.end[0] + ", " + this.end[1] + "], " : "\"end\": [1, +INF], ")
118
				+ "}";
119
	}
120
}