1   package eu.fbk.dh.tint.tokenizer.token;
2   
3   import java.util.ArrayList;
4   import java.util.HashMap;
5   import java.util.HashSet;
6   import java.util.Set;
7   
8   /**
9    * Created by alessio on 14/07/16.
10   */
11  
12  public class TokenGroup {
13  
14      private ArrayList<Token> support = new ArrayList<>();
15      private HashMap<Integer, Token> startIndexes = new HashMap<>();
16      private HashMap<Integer, Token> endIndexes = new HashMap<>();
17      private HashMap<Integer, Token> startOffIndexes = new HashMap<>();
18      private HashMap<Integer, Token> endOffIndexes = new HashMap<>();
19      private Set<Integer> newLines = new HashSet<>();
20  
21      public void addToken(Token token) {
22          support.add(token);
23          startIndexes.put(token.getStart(), token);
24          endIndexes.put(token.getEnd(), token);
25          startOffIndexes.put(token.getStart() + token.getSpaceOffset(), token);
26          endOffIndexes.put(token.getStart() + token.getSpaceOffset(), token);
27      }
28  
29      public void addNewLine(int offset) {
30          newLines.add(offset);
31      }
32  
33      public ArrayList<Token> getSupport() {
34          return support;
35      }
36  
37      public HashMap<Integer, Token> getStartIndexes() {
38          return startIndexes;
39      }
40  
41      public HashMap<Integer, Token> getEndIndexes() {
42          return endIndexes;
43      }
44  
45      public HashMap<Integer, Token> getStartOffIndexes() {
46          return startOffIndexes;
47      }
48  
49      public HashMap<Integer, Token> getEndOffIndexes() {
50          return endOffIndexes;
51      }
52  
53      public Set<Integer> getNewLines() {
54          return newLines;
55      }
56  
57  }