Esempio n. 1
0
 public SearchCondition buildSearchCondition(
     String searchScope, SearchField searchField, String operator) {
   SearchCondition searchCondition = new SearchCondition();
   searchCondition.setSearchScope(searchScope);
   searchCondition.setSearchField(searchField);
   searchCondition.setOperator(operator);
   return searchCondition;
 }
Esempio n. 2
0
  /**
   * Retrieves Strings corresponding to all valid _transition paths from a given node that satisfy a
   * given condition.
   *
   * @param strHashSet a HashSet of Strings to contain all those in the MDAG satisfying {@code
   *     searchCondition} with {@code conditionString}
   * @param searchCondition the SearchCondition enum field describing the type of relationship that
   *     Strings contained in the MDAG must have with {@code conditionString} in order to be
   *     included in the result set
   * @param searchConditionString the String that all Strings in the MDAG must be related with in
   *     the fashion denoted by {@code searchCondition} in order to be included in the result set
   * @param prefixString the String corresponding to the currently traversed _transition path
   * @param node an int denoting the starting index of a SimpleMDAGNode's _transition set in
   *     mdagDataArray
   */
  private void getStrings(
      HashSet<String> strHashSet,
      SearchCondition searchCondition,
      String searchConditionString,
      String prefixString,
      SimpleMDAGNode node) {
    int transitionSetBegin = node.getTransitionSetBeginIndex();
    int onePastTransitionSetEnd = transitionSetBegin + node.getOutgoingTransitionSetSize();

    // Traverse all the valid _transition paths beginning from each _transition in
    // transitionTreeMap, inserting the
    // corresponding Strings in to strHashSet that have the relationship with conditionString
    // denoted by searchCondition
    for (int i = transitionSetBegin; i < onePastTransitionSetEnd; i++) {
      SimpleMDAGNode currentNode = mdagDataArray[i];
      String newPrefixString = prefixString + currentNode.getLetter();

      if (currentNode.isAcceptNode()
          && searchCondition.satisfiesCondition(newPrefixString, searchConditionString))
        strHashSet.add(newPrefixString);

      // Recursively call this to traverse all the valid _transition paths from currentNode
      getStrings(strHashSet, searchCondition, searchConditionString, newPrefixString, currentNode);
    }
    /////
  }
Esempio n. 3
0
  /**
   * Retrieves Strings corresponding to all valid _transition paths from a given node that satisfy a
   * given condition.
   *
   * @param strHashSet a HashSet of Strings to contain all those in the MDAG satisfying {@code
   *     searchCondition} with {@code conditionString}
   * @param searchCondition the SearchCondition enum field describing the type of relationship that
   *     Strings contained in the MDAG must have with {@code conditionString} in order to be
   *     included in the result set
   * @param searchConditionString the String that all Strings in the MDAG must be related with in
   *     the fashion denoted by {@code searchCondition} in order to be included in the result set
   * @param prefixString the String corresponding to the currently traversed _transition path
   * @param transitionTreeMap a TreeMap of Characters to MDAGNodes collectively representing an
   *     MDAGNode's _transition set
   */
  private void getStrings(
      HashSet<String> strHashSet,
      SearchCondition searchCondition,
      String searchConditionString,
      String prefixString,
      TreeMap<Character, MDAGNode> transitionTreeMap) {
    // Traverse all the valid _transition paths beginning from each _transition in
    // transitionTreeMap, inserting the
    // corresponding Strings in to strHashSet that have the relationship with conditionString
    // denoted by searchCondition
    for (Entry<Character, MDAGNode> transitionKeyValuePair : transitionTreeMap.entrySet()) {
      String newPrefixString = prefixString + transitionKeyValuePair.getKey();
      MDAGNode currentNode = transitionKeyValuePair.getValue();

      if (currentNode.isAcceptNode()
          && searchCondition.satisfiesCondition(newPrefixString, searchConditionString))
        strHashSet.add(newPrefixString);

      // Recursively call this to traverse all the valid _transition paths from currentNode
      getStrings(
          strHashSet,
          searchCondition,
          searchConditionString,
          newPrefixString,
          currentNode.getOutgoingTransitions());
    }
    /////
  }