1   package ixa.kaflib;
2   
3   import java.io.Serializable;
4   import java.util.ArrayList;
5   import java.util.List;
6   
7   
8   public class Mark implements Serializable {
9   
10      private String sid;
11  
12      private String type;
13  
14      private String lemma;
15  
16      /** Part of speech (optional). Possible values are:
17       * - common noun (N)
18       * - proper noun (R)
19       * - adjective (G)
20       * - verb (V)
21       * - preposition (P)
22       * - adverb (A)
23       * - conjunction (C)
24       * - determiner (D)
25       * - other (O)
26       **/
27      private String pos;
28  
29      private String morphofeat;
30  
31      private String markcase;
32  
33      private Span<Term> span;
34  
35      private List<ExternalRef> externalReferences;
36  
37  
38      Mark(String id, Span<Term> span) {
39  	/*
40  	if (span.size() < 1) {
41  	    throw new IllegalStateException("A Mark must have at least one WF");
42  	}
43  	*/
44  	this.sid = id;
45  	this.span = span;
46  	this.externalReferences = new ArrayList<ExternalRef>();
47      }
48  
49      public String getId() {
50  	return sid;
51      }
52  
53      void setId(String id) {
54  	this.sid = id;
55      }
56  
57      public boolean hasType() {
58  	return type != null;
59      }
60  
61      public String getType() {
62  	return type;
63      }
64  
65      public void setType(String type) {
66  	this.type = type;
67      }
68  
69      public boolean hasLemma() {
70  	return lemma != null;
71      }
72  
73      public String getLemma() {
74  	return lemma;
75      }
76  
77      public void setLemma(String lemma) {
78  	this.lemma = lemma;
79      }
80  
81      public boolean hasPos() {
82  	return pos != null;
83      }
84  
85      public String getPos() {
86  	return pos;
87      }
88  
89      public void setPos(String pos) {
90  	this.pos = pos;
91      }
92  
93      public boolean hasMorphofeat() {
94  	return morphofeat != null;
95      }
96  
97      public String getMorphofeat() {
98  	return morphofeat;
99      }
100 
101     public void setMorphofeat(String morphofeat) {
102 	this.morphofeat = morphofeat;
103     }
104 
105     public boolean hasCase() {
106 	return markcase != null;
107     }
108 
109     public String getCase() {
110 	return markcase;
111     }
112 
113     public void setCase(String termcase) {
114 	this.markcase = markcase;
115     }
116 
117     public String getStr() {
118 	String str = "";
119 	for (Term term : span.getTargets()) {
120 	    if (!str.isEmpty()) {
121 		str += " ";
122 	    }
123 	    str += term.getStr();
124 	}
125 	return str;
126     }
127 
128     public Span<Term> getSpan() {
129 	return this.span;
130     }
131 
132     public void setSpan(Span<Term> span) {
133 	this.span = span;
134     }
135 
136     public List<ExternalRef> getExternalRefs() {
137 	return externalReferences;
138     }
139 
140     public void addExternalRef(ExternalRef externalRef) {
141 	externalReferences.add(externalRef);
142     }
143 
144     public void addExternalRefs(List<ExternalRef> externalRefs) {
145 	externalReferences.addAll(externalRefs);
146     }
147 }