1   package eu.fbk.dh.tint.tokenizer.token;
2   
3   /**
4    * Created with IntelliJ IDEA.
5    * User: giuliano
6    * Date: 1/15/13
7    * Time: 2:01 PM
8    * To change this templatePageCounter use File | Settings | File Templates.
9    */
10  public class Token extends Extent {
11  
12      private static final long serialVersionUID = 1024396602591514749L;
13  
14      private String form, normForm;
15      private boolean preceedBySpace = false;
16  
17      private int spaceOffset;
18  
19      public boolean isPreceedBySpace() {
20          return preceedBySpace;
21      }
22  
23      public void setPreceedBySpace(boolean preceedBySpace) {
24          this.preceedBySpace = preceedBySpace;
25      }
26  
27      public int getSpaceOffset() {
28          return spaceOffset;
29      }
30  
31      public void setSpaceOffset(int spaceOffset) {
32          this.spaceOffset = spaceOffset;
33      }
34  
35      public void updateByToken(Token token) {
36          this.start = token.getStart();
37          this.end = token.getEnd();
38          this.spaceOffset = token.getSpaceOffset();
39  //        this.form = token.getForm();
40  //        this.normForm = token.getNormForm();
41  //        this.afterNewLine = token.isAfterNewLine();
42      }
43  
44      public Token(int start, int end, String form, String normForm) {
45          super(start, end);
46          this.form = form;
47          this.normForm = normForm;
48      }
49  
50      public Token(int start, int end, String form) {
51          this(start, end, form, form);
52      }
53  
54      public void setForm(String form) {
55          this.form = form;
56      }
57  
58      public String getForm() {
59          return form;
60      }
61  
62      public String getNormForm() {
63          return normForm;
64      }
65  
66      public void setNormForm(String normForm) {
67          this.normForm = normForm;
68      }
69  
70      public boolean equals(Object obj) {
71          if (obj instanceof Token) {
72              return equals((Token) obj);
73          }
74  
75          return false;
76      }
77  
78      @Override
79      public String toString() {
80          return form + "\t"
81                  + spaceOffset + "\t"
82                  + (spaceOffset + super.getStart()) + "\t"
83                  + isPreceedBySpace() + "\t"
84                  + super.toString();
85      }
86  
87  }