@Test public void testNormalizePhrase() { assertEquals("*query*", SearchView.normalizePhrase("*query*")); assertEquals("*query*", SearchView.normalizePhrase("*query")); assertEquals("*query*", SearchView.normalizePhrase("query*")); assertEquals("*query*", SearchView.normalizePhrase(" * query* **")); assertEquals("*", SearchView.normalizePhrase(" ***")); assertEquals("*", SearchView.normalizePhrase("")); assertEquals("*", SearchView.normalizePhrase(null)); assertEquals("*Stráž pokroku*", SearchView.normalizePhrase("Stráž pokroku")); }
static String normalizePhrase(String phrase) { phrase = phrase == null ? "" : phrase; phrase = phrase.replaceAll("^[\\s\\*]+|[\\s\\*]+$", ""); phrase = phrase.isEmpty() ? "*" : "*" + phrase + "*"; return phrase; }
SearchView { static String normalizePhrase(String phrase) { phrase = phrase == null ? "" : phrase; phrase = phrase.replaceAll("^[\\s\\*]+|[\\s\\*]+$", ""); phrase = phrase.isEmpty() ? "*" : "*" + phrase + "*"; return phrase; } }
SearchView { static String normalizePhrase(String phrase) { phrase = phrase == null ? "" : phrase; phrase = phrase.replaceAll("^[\\s\\*]+|[\\s\\*]+$", ""); phrase = phrase.isEmpty() ? "*" : "*" + phrase + "*"; return phrase; } SearchView(RemoteStorage storage);   SearchView(RemoteStorage storage, int maxLimit); }
SearchView { static String normalizePhrase(String phrase) { phrase = phrase == null ? "" : phrase; phrase = phrase.replaceAll("^[\\s\\*]+|[\\s\\*]+$", ""); phrase = phrase.isEmpty() ? "*" : "*" + phrase + "*"; return phrase; } SearchView(RemoteStorage storage);   SearchView(RemoteStorage storage, int maxLimit); void setLocale(Locale locale); List<Item> findQuery(String title, String label, String identifier, String owner, String model, Collection<String> hasOwners); List<Item> findQuery(Query q, String status); List<Item> findPhrase(String phrase); List<Item> find(String... pids); List<Item> find(boolean onlyActive, String... pids); List<Item> findDeleted(String... pids); List<Item> find(List<String> pids); List<Item> find(List<String> pids, boolean onlyActive); List<Item> findSortedChildren(String parentPid); List<Item> findChildren(String pid); List<Item> findChildrenHierarchy(String pid); List<Item> findLastCreated(int offset, String model, String user, String sort); List<Item> findLastCreated(int offset, String model, String user, String organization, String username, int limit, String sort); List<Item> findAlphabetical(int offset, String model, String user, String organization, String userName, int limit, String sort); List<Item> findLastModified(int offset, String model, String user, String organization, String username, int limit, String sort); List<Item> countModels(String model, String user, String organization, String username); List<Item> findAllObjects(); List<Item> findReferrers(String pid); List<Item> findByModel(String modelId); List<Item> findByModel(int offset, String modelId); List<Item> findByModel(int offset, String modelId, String orderBy); List<Item> findByModels(String modelId1, String modelId2); List<Item> findByModels(int offset, String modelId1, String modelId2); List<Item> findByModels(int offset, String modelId1, String modelId2, String orderBy); boolean isDeviceInUse(String deviceId); }
SearchView { static String normalizePhrase(String phrase) { phrase = phrase == null ? "" : phrase; phrase = phrase.replaceAll("^[\\s\\*]+|[\\s\\*]+$", ""); phrase = phrase.isEmpty() ? "*" : "*" + phrase + "*"; return phrase; } SearchView(RemoteStorage storage);   SearchView(RemoteStorage storage, int maxLimit); void setLocale(Locale locale); List<Item> findQuery(String title, String label, String identifier, String owner, String model, Collection<String> hasOwners); List<Item> findQuery(Query q, String status); List<Item> findPhrase(String phrase); List<Item> find(String... pids); List<Item> find(boolean onlyActive, String... pids); List<Item> findDeleted(String... pids); List<Item> find(List<String> pids); List<Item> find(List<String> pids, boolean onlyActive); List<Item> findSortedChildren(String parentPid); List<Item> findChildren(String pid); List<Item> findChildrenHierarchy(String pid); List<Item> findLastCreated(int offset, String model, String user, String sort); List<Item> findLastCreated(int offset, String model, String user, String organization, String username, int limit, String sort); List<Item> findAlphabetical(int offset, String model, String user, String organization, String userName, int limit, String sort); List<Item> findLastModified(int offset, String model, String user, String organization, String username, int limit, String sort); List<Item> countModels(String model, String user, String organization, String username); List<Item> findAllObjects(); List<Item> findReferrers(String pid); List<Item> findByModel(String modelId); List<Item> findByModel(int offset, String modelId); List<Item> findByModel(int offset, String modelId, String orderBy); List<Item> findByModels(String modelId1, String modelId2); List<Item> findByModels(int offset, String modelId1, String modelId2); List<Item> findByModels(int offset, String modelId1, String modelId2, String orderBy); boolean isDeviceInUse(String deviceId);  }