setPartOf(Element)   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 Element 
9
{
10
	private String id;
11
	private String name;
12
	private String type;
13
	private Element partOf;
14
	
15
	/**
16
	 * 
17
	 * @param id
18
	 * @param name
19
	 * @param type
20
	 */
21
	protected Element(String id, String name, String type) {
22
		this.id = id;
23
		this.name = name;
24
		this.type = type;
25
		this.partOf = null;
26
	}
27
	
28
	/**
29
	 * 
30
	 * @param id
31
	 * @param name
32
	 * @param type
33
	 * @param element
34
	 */
35
	protected Element(String id, String name, String type, Element element) {
36
		this(id, name, type);
37
		this.partOf = element;
38
	}
39
40
	/**
41
	 * 
42
	 * @return
43
	 */
44
	public String getId() {
45
		return id;
46
	}
47
	
48
	/**
49
	 * 
50
	 * @return
51
	 */
52
	public String getName() {
53
		return name;
54
	}
55
	
56
	/**
57
	 * 
58
	 * @return
59
	 */
60
	public Element getPartOf() {
61
		return partOf;
62
	}
63
	
64
	/**
65
	 * 
66
	 * @param partOf
67
	 */
68
	public void setPartOf(Element partOf) {
69
		this.partOf = partOf;
70
	}
71
	
72
	/**
73
	 * 
74
	 * @return
75
	 */
76
	public String getType() {
77
		return type;
78
	}
79
	
80
	/**
81
	 * 
82
	 */
83
	@Override
84
	public int hashCode() {
85
		final int prime = 31;
86
		int result = 1;
87
		result = prime * result + ((id == null) ? 0 : id.hashCode());
88
		result = prime * result + ((name == null) ? 0 : name.hashCode());
89
		return result;
90
	}
91
92
	/**
93
	 * 
94
	 */
95
	@Override
96
	public boolean equals(Object obj) {
97
		if (this == obj)
98
			return true;
99
		if (obj == null)
100
			return false;
101
		if (getClass() != obj.getClass())
102
			return false;
103
		Element other = (Element) obj;
104
		if (id == null) {
105
			if (other.id != null)
106
				return false;
107
		} else if (!id.equals(other.id))
108
			return false;
109
		if (name == null) {
110
			if (other.name != null)
111
				return false;
112
		} else if (!name.equals(other.name))
113
			return false;
114
		return true;
115
	}
116
117
	/**
118
	 * 
119
	 */
120
	@Override
121
	public String toString() {
122
		return "[Element id=" + this.id + ", name= " +  this.name + ", type= \"" + this.type + "\"]";
123
	}
124
}
125