Created with IntelliJ IDEA. @Author: 杜凯 @Date: 2023/11/06/19:09 @Description: the server's process about the search algorithm of JXT++
| 19 | * @Description: the server's process about the search algorithm of JXT++ |
| 20 | */ |
| 21 | public class Server_JXTpp { |
| 22 | private Map<BigInteger, ArrayList<byte[]>> tset; |
| 23 | private Bloom[] f; |
| 24 | private Xor8[] xor; |
| 25 | private BigInteger stag1; |
| 26 | |
| 27 | public Server_JXTpp(Map<BigInteger, ArrayList<byte[]>> tset, Setup_JXTpp[] table, BigInteger stag) { |
| 28 | int table_num = table.length; |
| 29 | this.tset = tset; |
| 30 | this.stag1 = stag; |
| 31 | f = new Bloom[table_num]; |
| 32 | xor = new Xor8[table_num]; |
| 33 | for (int i = 0; i < table_num; i++) { |
| 34 | f[i] = table[i].getF(); |
| 35 | xor[i] = table[i].getXor(); |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * the server operations of the search algorithm for JXT++ |
| 41 | * @param join_tokens jointokens |
| 42 | * @return the matching results |
| 43 | */ |
| 44 | public ArrayList<byte[][]> search(ArrayList<byte[][]> join_tokens) { |
| 45 | ArrayList<byte[][]> res = new ArrayList<>(); |
| 46 | ArrayList<byte[]> token1_tset = tset.get(stag1); |
| 47 | |
| 48 | for (int i = 0; i < token1_tset.size(); i++) { |
| 49 | byte[] token1 = token1_tset.get(i); |
| 50 | long[] xtoken1_long = new long[join_tokens.size()]; |
| 51 | for (int j = 1; j < join_tokens.size(); j++) { |
| 52 | byte[] xtoken1 = tool.Xor(token1, join_tokens.get(j)[0]); |
| 53 | xtoken1_long[j] = tool.bytesToLong(xtoken1); |
| 54 | if (!f[j].mayContain(xtoken1_long[j])) { |
| 55 | break; |
| 56 | } |
| 57 | if (j == join_tokens.size() - 1) { |
| 58 | xtoken1_long[0] = tool.bytesToLong(tool.Xor(token1, join_tokens.get(0)[0])); |
| 59 | for (int k = 0; k < join_tokens.size(); k++) { |
| 60 | byte[][] join_token = join_tokens.get(k); |
| 61 | byte[][] ct = new byte[join_token.length][]; |
| 62 | for (int h = 0; h < join_token.length; h++) { |
| 63 | long xtoken; |
| 64 | if (h == 0) xtoken = xtoken1_long[k]; |
| 65 | xtoken = tool.bytesToLong(tool.Xor(token1, join_token[h])); |
| 66 | ct[h] = xor[k].search(xtoken); |
| 67 | } |
| 68 | res.add(ct); |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | } |
| 73 | return res; |
| 74 | } |
| 75 | } |
nothing calls this directly
no outgoing calls
no test coverage detected