1
15
16 package gate.wordnet;
17
18
19 class RelationImpl implements Relation {
20
21 private int type;
22
23
24 protected RelationImpl(int _type) {
25 this.type = _type;
26 }
27
28
29
30 public int getType() {
31 return this.type;
32 }
33
34
35
36 public String getSymbol() {
37 return WNHelper.int2PointerType(this.type).getKey();
38 }
39
40
41
42 public String getLabel() {
43 return WNHelper.int2PointerType(this.type).getLabel();
44 }
45
46
47
48 public int getInverseType() {
49
50 switch(this.type) {
51
52 case Relation.REL_ANTONYM:
53 return Relation.REL_ANTONYM;
54
55 case Relation.REL_HYPONYM:
56 return Relation.REL_HYPERNYM;
57
58 case Relation.REL_HYPERNYM:
59 return Relation.REL_HYPONYM;
60
61 case Relation.REL_MEMBER_HOLONYM:
62 return Relation.REL_MEMBER_MERONYM;
63
64 case Relation.REL_MEMBER_MERONYM:
65 return Relation.REL_MEMBER_HOLONYM;
66
67 case Relation.REL_SIMILAR_TO:
68 return Relation.REL_SIMILAR_TO;
69
70 case Relation.REL_ATTRIBUTE:
71 return Relation.REL_ATTRIBUTE;
72
73 case Relation.REL_VERB_GROUP:
74 return Relation.REL_VERB_GROUP;
75
76 default:
77 return -1;
78 }
79 }
80
81
82
83 public boolean isApplicableTo(int pos) {
84 return WNHelper.int2PointerType(this.type).appliesTo(WNHelper.int2POS(pos));
85 }
86
87 }