/* (non-Javadoc)
@see jline.console.ConsoleReader#searchBackwards(java.lang.String, int, boolean)
Overrides and replaces search logic to make it case-insensitive.
432032
@Override
    public int searchBackwards(String searchTerm, int startIndex, boolean startsWith)
    {
        ListIterator<jline.console.history.History.Entry> it = this.getHistory().entries(startIndex);
        while (it.hasPrevious()) {
            jline.console.history.History.Entry e = it.previous();
            String itemNormalized = e.value().toString().toLowerCase();
            String termNormalized = searchTerm.toLowerCase();
            if (startsWith) {
                if (itemNormalized.startsWith(termNormalized)) {
                    return e.index();
                }
            }
            else {
                if (itemNormalized.contains(termNormalized)) {
                    return e.index();
                }
            }
        }
        return -1;
    }
749814
public void setConditionalForwarders(java.util.Collection<ConditionalForwarder> conditionalForwarders) {
        if (conditionalForwarders == null) {
            this.conditionalForwarders = null;
            return;
        }

        this.conditionalForwarders = new com.amazonaws.internal.SdkInternalList<ConditionalForwarder>(conditionalForwarders);
    }
358608
private void moveSlotBefore() {
		/*
		 * int slot = 0; while (slot < currentPage.getNumRecords() &&
		 * searchRange.largerThan(getKey(currentPage, slot))) slot++;
		 * 
		 * currentSlot = slot - 1;
		 */
		// Optimization: Use binary search rather than sequential search
		int startSlot = 0, endSlot = currentPage.getNumRecords() - 1;
		int middleSlot = (startSlot + endSlot) / 2;
		SearchKey searchMin = searchRange.getMin();

		if (endSlot >= 0) {
			while (middleSlot != startSlot) {
				if (searchMin.compareTo(
						getKey(currentPage, middleSlot, keyType.length())) > 0)
					startSlot = middleSlot;
				else
					endSlot = middleSlot;

				middleSlot = (startSlot + endSlot) / 2;
			}
			
			if (searchMin.compareTo(
					getKey(currentPage, endSlot, keyType.length())) > 0)
				currentSlot = endSlot;
			else if (searchMin.compareTo(
					getKey(currentPage, startSlot, keyType.length())) > 0)
				currentSlot = startSlot;
			else
				currentSlot = startSlot - 1;
		} else
			currentSlot = -1;
	}
625501
private boolean matchPreservesCase(List<Match> suggestionMatches, String msg) {
    if (suggestionMatches != null && !suggestionMatches.isEmpty()) {
      //PatternRule rule = (PatternRule) this.rule;
      int sugStart = msg.indexOf(SUGGESTION_START_TAG) + SUGGESTION_START_TAG.length();
      for (Match sMatch : suggestionMatches) {
        if (!sMatch.isInMessageOnly() && sMatch.convertsCase()
            && msg.charAt(sugStart) == '\\') {
          return false;
        }
      }
    }
    return true;
  }
29139
public void clearTextSearch() {

        m_searchObject.clearFullTextSearch();
        m_handler.onClearFullTextSearch();
        updateResultsTab(false);
        ValueChangeEvent.fire(this, m_searchObject);
    }
699908
function endsWith(target, searchString, position) {
  position = position || target.length;
  position = position - searchString.length;
  let lastIndex = target.lastIndexOf(searchString);
  return lastIndex !== -1 && lastIndex === position;
}
1111405
private void pessimisticFind(
                                SearchComparator  comp,
                                Object            searchKey,
                                SearchNode        point)
    {
        point.reset();

        synchronized(this)
        {
            internalFind(comp, searchKey, point);
            _pessimisticFinds++;
        }
    }
1096921
private String findSearchStrings(final int start) {
		String longestMatch = null;

		// Loop for each string
		for (int i = 0; i < search.length; i++) {
			// No point checking a String that's too long
			if (start + search[i].length() > bufferLen) {
				continue;
			}

			boolean found = true;

			// Loop for each character in range
			for (int j = 0; j < search[i].length() && (start + j < bufferLen); j++) {
				int diff = buffer[start + j] - search[i].charAt(j);

				if (diff < 0) {
					// Since the strings are all sorted, we can abort if
					// the character is less than the corresponding character in
					// the current search string.
					return longestMatch;
				} else if (diff != 0) {
					found = false;
					break;
				}
			}

			if (found && (longestMatch == null || longestMatch.length() < search[i].length())) {
				longestMatch = search[i];
			}
		}

		return longestMatch;
	}
1016282
function consonantStringBackwards(tokens, i, orig_i) {
	var out = [];
	var t = '';
	while (i >= orig_i && tokens[i] != null) {
		t = tokens[i--];
		if (t == '+' || t == '^') continue;
		if (consonant(t) == null) break;
		out.unshift(t);
	}
	return out.join("+");
}
537088
private boolean forwardMatch(String match, boolean ignoreCase, boolean resetOnTrue)
      throws
      IOException
  {
    Mark mark = reader.mark();
    List<Integer> cbuf = Lists.newArrayList();
    StringBuilder builder = new StringBuilder();

    boolean result = true;
    boolean seenChar = false;

    while (true)
    {
      cbuf.add(reader.next());

      char ch = (char) reader.curChar;

      if (reader.curChar == -1)
      {
        result = false;
        break;
      }
      else if (WHITESPACE.matches(ch))
      {
        if (seenChar)
        {
          builder.append(ch);
        }
      }
      else
      {
        if (builder.length() == 0)
        {
          seenChar = true;
        }
        builder.append(ch);
        int index = builder.length() - 1;

        if (!ignoreCase
            && (builder.charAt(index) == match.charAt(index)))
        {
          result = false;
          break;
        }

        if (ignoreCase
            && (Ascii.toLowerCase(builder.charAt(index)) != Ascii
            .toLowerCase(match.charAt(index))))
        {
          result = false;
          break;
        }
      }

      if (builder.length() == match.length())
      {
        if (!match.equalsIgnoreCase(builder.toString()))
        {
          result = false;
        }
        break;
      }
    }

    if (!result || resetOnTrue)
    {
      reader.unread(cbuf, mark);
    }

    return result;
  }
738936
protected boolean isNullcaseForEscape(String nextLine, boolean inQuotes, int i, String sb) {
        boolean result = false, hasmet = false;
        for (int k = 0; k < sb.length(); k++) {
            char c = sb.charAt(k);
            if (Character.isWhitespace(c)) continue;
            else if (c == quotechar) {
                if (!inQuotes || hasmet) return false;
                hasmet = true;
                continue;
            } else
                return false;
        }
        hasmet = false;
        if (nextLine.length() > (i + 1) && (nextLine.charAt(i + 1) == 'N' )) {
            for (int j=i+2;j < nextLine.length(); j++) {
                char c = nextLine.charAt(j);
                if (Character.isWhitespace(c)) continue;
                else if (c == quotechar) {
                    if (!inQuotes || hasmet) return false;
                    hasmet = true;
                    continue;
                } else if (c == separator) break;
                else return false;
            }
            result = true;
        }
        return result;
    }
484796
private String checkForwardto(final HttpServletRequest request) throws Throwable {
    String reqpar = request.getParameter("forwardto");
    return reqpar;
  }
1315194
boolean lookForwardLineFeedAndEof() {
		int forwardBak = forward;
		int forwardRowBak = forwardRow;
		for (char c=peek(); true; c=next()) {
			if (CharTable.isBlank(c)) {
				continue ;
			}
			if (c == '\n' || c == EOF) {
				return true;
			}
			forward = forwardBak;
			forwardRow = forwardRowBak;
			return false;
		}
	}
584894
private void assureReturnObjFlagSet(SearchControls controls) {
		Assert.notNull(controls, "controls must not be null");
		if (!controls.getReturningObjFlag()) {
			LOG.debug("The returnObjFlag of supplied SearchControls is not set"
                    + " but a ContextMapper is used - setting flag to true");
			controls.setReturningObjFlag(true);
		}
	}
359795
def search_next(self):
        

        pattern = self.get_selected_text() or self.__search_pattern
        if not pattern:
            return False

        return self.search(pattern, **{"case_sensitive": True,
                                       "whole_word": False,
                                       "regular_expressions": False,
                                       "backward_search": False,
                                       "wrap_around": True})
223252
public ResourceHandle findUpwards(String basePath, Pattern namePattern, String childType) {
        ResourceHandle current = this;
        while (current != null && current.isValid()) {
            ResourceHandle base = ResourceHandle.use(current.getChild(basePath));
            if (base.isValid()) {
                for (ResourceHandle child : base.getChildrenByType(childType)) {
                    if (namePattern.matcher(child.getName()).matches()) {
                        return child;
                    }
                }
            }
            current = current.getParent();
        }
        return null;
    }
416332
@Action(semantics = SemanticsOf.SAFE)
    public List<ApplicationTenancy> findMatching(final String search) {
        if (search != null && search.length() > 0) {
            return findByNameOrPathMatching(search);
        }
        return Lists.newArrayList();
    }