1 | package org.biohackathon.SPARQLBuilder.OWL;
|
---|
2 |
|
---|
3 | public class Label {
|
---|
4 |
|
---|
5 | private String label = null;
|
---|
6 | private String language = null;
|
---|
7 |
|
---|
8 | public boolean equals(Object oLabel) {
|
---|
9 | if( oLabel == null ){
|
---|
10 | return false;
|
---|
11 | }
|
---|
12 | Label loLabel = (Label) oLabel;
|
---|
13 | if (label != null) {
|
---|
14 | if (!label.equals(loLabel.getLabel())) {
|
---|
15 | return false;
|
---|
16 | }
|
---|
17 | } else {
|
---|
18 | if (loLabel.getLabel() != null) {
|
---|
19 | return false;
|
---|
20 | }
|
---|
21 | }
|
---|
22 |
|
---|
23 | if (language != null) {
|
---|
24 | return language.equals(loLabel.getLanguage());
|
---|
25 | } else {
|
---|
26 | return loLabel.getLanguage() == null;
|
---|
27 | }
|
---|
28 | }
|
---|
29 |
|
---|
30 | public Label(String label, String language) {
|
---|
31 | this.label = label;
|
---|
32 | this.language = language;
|
---|
33 | }
|
---|
34 |
|
---|
35 | public String getLabel() {
|
---|
36 | return label;
|
---|
37 | }
|
---|
38 |
|
---|
39 | public void setLabel(String label) {
|
---|
40 | this.label = label;
|
---|
41 | }
|
---|
42 |
|
---|
43 | public String getLanguage() {
|
---|
44 | return language;
|
---|
45 | }
|
---|
46 |
|
---|
47 | public void setLanguage(String language) {
|
---|
48 | this.language = language;
|
---|
49 | }
|
---|
50 |
|
---|
51 | public String toString() {
|
---|
52 | StringBuffer sb = new StringBuffer();
|
---|
53 | sb.append("\"");
|
---|
54 | if (label != null) {
|
---|
55 | sb.append(label);
|
---|
56 | }
|
---|
57 | sb.append("\"");
|
---|
58 | if (language != null) {
|
---|
59 | sb.append("@");
|
---|
60 | sb.append(language);
|
---|
61 | }
|
---|
62 | return sb.toString();
|
---|
63 | }
|
---|
64 |
|
---|
65 | }
|
---|