Project

General

Profile

1
package eu.dnetlib.data.mapreduce.util;
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
	public RelDescriptor(String value) {
15
		super();
16
		this.it = value;
17

    
18
		String[] s = value.split("_");
19

    
20
		this.relType = RelType.valueOf(s[0]);
21
		this.subRelType = SubRelType.valueOf(s[1]);
22
	}
23

    
24
	public SubRelType getSubRelType() {
25
		return subRelType;
26
	}
27

    
28
	public RelType getRelType() {
29
		return relType;
30
	}
31

    
32
	public String getIt() {
33
		return it;
34
	}
35

    
36
	@Override
37
	public String toString() {
38
		return getIt();
39
	}
40

    
41
	@Override
42
	public int hashCode() {
43
		final int prime = 31;
44
		int result = 1;
45
		result = prime * result + ((it == null) ? 0 : it.hashCode());
46
		return result;
47
	}
48

    
49
	@Override
50
	public boolean equals(Object obj) {
51
		if (this == obj) return true;
52
		if (obj == null) return false;
53
		if (getClass() != obj.getClass()) return false;
54
		RelDescriptor other = (RelDescriptor) obj;
55
		if (it == null) {
56
			if (other.it != null) return false;
57
		} else if (!it.equals(other.it)) return false;
58
		return true;
59
	}
60

    
61
}
(5-5/5)