예제 #1
0
  public static String processSingleQuery(String line, BPlusTree bTree) {
    URLList queryResult = bTree.getURLs(line.hashCode());

    if (queryResult != null) {
      return Searcher.getURLString(queryResult);
    } else {
      return "The word \"" + line + "\" has NOT been found.";
    }
  }
예제 #2
0
  public static String processAnd(StringTokenizer tokenizer, BPlusTree bTree) {
    String x = tokenizer.nextToken();
    String y = tokenizer.nextToken();
    x = trimSpaces(x);
    y = trimSpaces(y);

    URLList commonURLs = findCommonURLs(x, y, bTree);

    return Searcher.getURLString(commonURLs);
  }
예제 #3
0
  public static String processOr(StringTokenizer tokenizer, BPlusTree bTree) {
    String x = tokenizer.nextToken();
    String y = tokenizer.nextToken();

    x = trimSpaces(x);
    y = trimSpaces(y);

    URLList xURLs = bTree.getURLs(x.hashCode());
    URLList yURLs = bTree.getURLs(y.hashCode());

    URLList current = xURLs;

    while (current.next != null) {
      current = current.next;
    }

    current.next = yURLs;

    return Searcher.getURLString(xURLs);
  }