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 package org.utgenome.gwt.utgb.client.bio;
26
27 import java.io.Serializable;
28 import java.util.ArrayList;
29 import java.util.List;
30
31
32
33
34
35
36
37 public class KeywordSearchResult implements Serializable {
38
39 private static final long serialVersionUID = 1L;
40
41 public int page;
42 public int count;
43 public int maxPage;
44 public List<Entry> result = new ArrayList<Entry>();
45
46 public static class Entry implements Serializable {
47 private static final long serialVersionUID = 1L;
48
49 public String name = "";
50 public String chr = "";
51 public int start;
52 public int end;
53 public String ref = "";
54 public String offsets = null;
55 public int id;
56 public int rowid;
57
58 public String getHit() {
59 if (offsets != null) {
60 String[] offsetData = offsets.split(" ");
61 if (offsetData == null || offsetData.length < 4)
62 return name;
63
64 StringBuilder nameBuf = new StringBuilder();
65 for (int i = 0; i < offsetData.length; i += 4) {
66 if (i > 0)
67 nameBuf.append(" ");
68
69 int startIndex = Integer.parseInt(offsetData[i + 2]);
70 int byteLength = Integer.parseInt(offsetData[i + 3]);
71 nameBuf.append(name.substring(startIndex, startIndex + byteLength));
72 }
73 return nameBuf.toString();
74 }
75
76 return name;
77 }
78 }
79
80 }