TEISegmentImpl.java
1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
package ipipan.clarin.tei.impl.entities;
import ipipan.clarin.tei.api.entities.TEIParagraph;
import ipipan.clarin.tei.api.entities.TEISegment;
/**
*
* @author mlenart
*/
class TEISegmentImpl extends TEIAbstractEntity implements TEISegment {
private TEIParagraph paragraph;
private int offset;
private int length;
private String orth;
private final boolean nps;
private int choiceNum = 0;
private boolean rejected = false;
public TEISegmentImpl(TEIParagraph paragraph, String id, int offset,
int length, boolean nps) {
super(id);
this.paragraph = paragraph;
this.offset = offset;
this.length = length;
this.nps = nps;
this.orth = null;
}
public TEISegmentImpl(String id, String orth, boolean nps) {
super(id);
this.orth = orth;
this.nps = nps;
this.offset = -1;
this.length = -1;
this.paragraph = null;
}
@Override
public TEIParagraph getParagraph() {
return paragraph;
}
@Override
public void setParagraph(TEIParagraph paragraph) {
this.paragraph = paragraph;
}
@Override
public int getOffset() {
return offset;
}
@Override
public void setOffset(int offset) {
this.offset = offset;
}
@Override
public int getLength() {
if (orth != null) {
return orth.length();
} else {
return length;
}
}
@Override
public boolean hasNps() {
return nps;
}
@Override
public String getOrth() {
if (orth != null) {
return orth;
} else {
return paragraph.getText().substring(offset, offset + length);
}
}
@Override
public int getChoiceNum() {
return choiceNum;
}
@Override
public void setChoiceNum(int choiceNum) {
this.choiceNum = choiceNum;
}
@Override
public boolean isRejected() {
return rejected;
}
@Override
public void setRejected(boolean rejected) {
this.rejected = rejected;
}
}