getName()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 2
c 0
b 0
f 0
cc 1
rs 10
1
package it.cnr.istc.pst.cognition.koala.reasoner.environment.parser.xml;
2
3
/**
4
 * 
5
 * @author alessandroumbrico
6
 *
7
 */
8
public class Sensor 
9
{
10
	private String id;
11
	private String name;
12
	private String type;
13
	private SensorState state;
14
	private Element owner;
15
	private Element target;
16
	
17
	/**
18
	 * 
19
	 * @param id
20
	 * @param name
21
	 * @param type
22
	 * @param state
23
	 * @param owner
24
	 * @param target
25
	 */
26
	protected Sensor(String id, String name, String type, SensorState state, Element owner, Element target) {
27
		this.id = id;
28
		this.name = name;
29
		this.type = type;
30
		this.state = state;
31
		this.owner = owner;
32
		this.target = target;
33
	}
34
	
35
	/**
36
	 * 
37
	 * @return
38
	 */
39
	public String getId() {
40
		return id;
41
	}
42
	
43
	/**
44
	 * 
45
	 * @return
46
	 */
47
	public String getName() {
48
		return name;
49
	}
50
	
51
	/**
52
	 * 
53
	 * @return
54
	 */
55
	public String getType() {
56
		return type;
57
	}
58
	
59
	/**
60
	 * 
61
	 * @return
62
	 */
63
	public Element getOwner() {
64
		return owner;
65
	}
66
	
67
	/**
68
	 * 
69
	 * @return
70
	 */
71
	public SensorState getState() {
72
		return state;
73
	}
74
	
75
	/**
76
	 * 
77
	 * @return
78
	 */
79
	public Element getTarget() {
80
		return target;
81
	}
82
	
83
	
84
	
85
	/**
86
	 * 
87
	 */
88
	@Override
89
	public int hashCode() {
90
		final int prime = 31;
91
		int result = 1;
92
		result = prime * result + ((id == null) ? 0 : id.hashCode());
93
		result = prime * result + ((name == null) ? 0 : name.hashCode());
94
		return result;
95
	}
96
97
	/**
98
	 * 
99
	 */
100
	@Override
101
	public boolean equals(Object obj) {
102
		if (this == obj)
103
			return true;
104
		if (obj == null)
105
			return false;
106
		if (getClass() != obj.getClass())
107
			return false;
108
		Sensor other = (Sensor) obj;
109
		if (id == null) {
110
			if (other.id != null)
111
				return false;
112
		} else if (!id.equals(other.id))
113
			return false;
114
		if (name == null) {
115
			if (other.name != null)
116
				return false;
117
		} else if (!name.equals(other.name))
118
			return false;
119
		return true;
120
	}
121
122
	/**
123
	 * 
124
	 */
125
	@Override
126
	public String toString() {
127
		return "[Sensor id=" + this.id + ", name= " +  this.name + ", type= \"" + this.type + "\"]";
128
	}
129
}
130