Project

General

Profile

« Previous | Next » 

Revision 44949

fixed test

View differences:

RelDescriptor.java
1 1
package eu.dnetlib.data.mapreduce.util;
2 2

  
3
import eu.dnetlib.data.proto.RelTypeProtos.RelType;
4
import eu.dnetlib.data.proto.RelTypeProtos.SubRelType;
5 3

  
6 4
public class RelDescriptor {
7 5

  
8
	private final String it;
6
    private final String code;
9 7

  
10
	private final RelType relType;
8
    private final String ontologyCode;
11 9

  
12
	private final SubRelType subRelType;
10
    private final String termCode;
13 11

  
14
	private final String relClass;
15

  
16 12
	public RelDescriptor(final String value) {
17 13
		super();
18
		this.it = value;
14
        this.code = value;
19 15

  
20 16
		String[] s = value.split("_");
21 17

  
22
		this.relType = RelType.valueOf(s[0]);
23
		this.subRelType = SubRelType.valueOf(s[1]);
24
		this.relClass = s[2];
25
	}
18
        this.ontologyCode = s[0];
19
        this.termCode = s[1];
20
    }
26 21

  
27
	public SubRelType getSubRelType() {
28
		return subRelType;
29
	}
30 22

  
31
	public RelType getRelType() {
32
		return relType;
33
	}
23
    public String getCode() {
24
        return code;
25
    }
34 26

  
35
	public String getRelClass() {
36
		return relClass;
37
	}
27
    public String getOntologyCode() {
28
        return ontologyCode;
29
    }
38 30

  
39
	public String getIt() {
40
		return it;
41
	}
31
    public String getTermCode() {
32
        return termCode;
33
    }
42 34

  
43
	@Override
35

  
36
    @Override
44 37
	public String toString() {
45
		return getIt();
46
	}
38
        return getCode();
39
    }
47 40

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

  
56 49
	@Override
......
59 52
		if (obj == null) return false;
60 53
		if (getClass() != obj.getClass()) return false;
61 54
		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;
55
        if (code == null) {
56
            if (other.code != null) return false;
57
        } else if (!code.equals(other.code)) return false;
58
        return true;
66 59
	}
67 60

  
68 61
}

Also available in: Unified diff