1
|
package eu.dnetlib.data.graph.utils;
|
2
|
|
3
|
import eu.dnetlib.data.proto.RelTypeProtos.RelType;
|
4
|
import eu.dnetlib.data.proto.RelTypeProtos.SubRelType;
|
5
|
|
6
|
public class RelDescriptor {
|
7
|
|
8
|
private final String it;
|
9
|
|
10
|
private final RelType relType;
|
11
|
|
12
|
private final SubRelType subRelType;
|
13
|
|
14
|
private final String relClass;
|
15
|
|
16
|
public RelDescriptor(final String value) {
|
17
|
super();
|
18
|
this.it = value;
|
19
|
|
20
|
String[] s = value.split("_");
|
21
|
|
22
|
this.relType = RelType.valueOf(s[0]);
|
23
|
this.subRelType = SubRelType.valueOf(s[1]);
|
24
|
this.relClass = s[2];
|
25
|
}
|
26
|
|
27
|
public SubRelType getSubRelType() {
|
28
|
return subRelType;
|
29
|
}
|
30
|
|
31
|
public RelType getRelType() {
|
32
|
return relType;
|
33
|
}
|
34
|
|
35
|
public String getRelClass() {
|
36
|
return relClass;
|
37
|
}
|
38
|
|
39
|
public String getIt() {
|
40
|
return it;
|
41
|
}
|
42
|
|
43
|
@Override
|
44
|
public String toString() {
|
45
|
return getIt();
|
46
|
}
|
47
|
|
48
|
@Override
|
49
|
public int hashCode() {
|
50
|
final int prime = 31;
|
51
|
int result = 1;
|
52
|
result = (prime * result) + ((it == null) ? 0 : it.hashCode());
|
53
|
return result;
|
54
|
}
|
55
|
|
56
|
@Override
|
57
|
public boolean equals(final Object obj) {
|
58
|
if (this == obj) return true;
|
59
|
if (obj == null) return false;
|
60
|
if (getClass() != obj.getClass()) return false;
|
61
|
RelDescriptor other = (RelDescriptor) obj;
|
62
|
if (it == null) {
|
63
|
if (other.it != null) return false;
|
64
|
} else if (!it.equals(other.it)) return false;
|
65
|
return true;
|
66
|
}
|
67
|
|
68
|
}
|