@Test public void test() throws Exception { final MindMap mm = new MindMap(true); final Topic topic = new Topic(mm, null, "авы аыва вы Что то"); assertTrue(topic.containsPattern(null, Pattern.compile(Pattern.quote("Что"), Pattern.CASE_INSENSITIVE), true, null)); assertTrue(topic.containsPattern(null, Pattern.compile(Pattern.quote("что"), Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE), true, null)); }
public boolean containsPattern(final @Nullable File baseFolder, final @Nonnull Pattern pattern, final boolean findInTopicText, @Nullable final Set<Extra.ExtraType> extrasForSearch) { boolean result = false; if (findInTopicText && pattern.matcher(this.text).find()) { result = true; } else if (extrasForSearch != null && !extrasForSearch.isEmpty()) { for (final Extra<?> e : this.extras.values()) { if (extrasForSearch.contains(e.getType()) && e.containsPattern(baseFolder, pattern)) { result = true; break; } } } return result; }
Topic implements Serializable, Constants, Iterable<Topic> { public boolean containsPattern(final @Nullable File baseFolder, final @Nonnull Pattern pattern, final boolean findInTopicText, @Nullable final Set<Extra.ExtraType> extrasForSearch) { boolean result = false; if (findInTopicText && pattern.matcher(this.text).find()) { result = true; } else if (extrasForSearch != null && !extrasForSearch.isEmpty()) { for (final Extra<?> e : this.extras.values()) { if (extrasForSearch.contains(e.getType()) && e.containsPattern(baseFolder, pattern)) { result = true; break; } } } return result; } }
Topic implements Serializable, Constants, Iterable<Topic> { public boolean containsPattern(final @Nullable File baseFolder, final @Nonnull Pattern pattern, final boolean findInTopicText, @Nullable final Set<Extra.ExtraType> extrasForSearch) { boolean result = false; if (findInTopicText && pattern.matcher(this.text).find()) { result = true; } else if (extrasForSearch != null && !extrasForSearch.isEmpty()) { for (final Extra<?> e : this.extras.values()) { if (extrasForSearch.contains(e.getType()) && e.containsPattern(baseFolder, pattern)) { result = true; break; } } } return result; } Topic(@Nonnull final MindMap mindMap, @Nonnull final Topic base, final boolean copyChildren);  Topic(@Nonnull final MindMap map, @Nullable final Topic parent, @Nonnull final String text, @Nonnull @MayContainNull final Extra<?>... extras); private  Topic(@Nonnull final MindMap map, @Nonnull final String text, @Nonnull @MayContainNull final Extra<?>... extras); }
Topic implements Serializable, Constants, Iterable<Topic> { public boolean containsPattern(final @Nullable File baseFolder, final @Nonnull Pattern pattern, final boolean findInTopicText, @Nullable final Set<Extra.ExtraType> extrasForSearch) { boolean result = false; if (findInTopicText && pattern.matcher(this.text).find()) { result = true; } else if (extrasForSearch != null && !extrasForSearch.isEmpty()) { for (final Extra<?> e : this.extras.values()) { if (extrasForSearch.contains(e.getType()) && e.containsPattern(baseFolder, pattern)) { result = true; break; } } } return result; } Topic(@Nonnull final MindMap mindMap, @Nonnull final Topic base, final boolean copyChildren);  Topic(@Nonnull final MindMap map, @Nullable final Topic parent, @Nonnull final String text, @Nonnull @MayContainNull final Extra<?>... extras); private  Topic(@Nonnull final MindMap map, @Nonnull final String text, @Nonnull @MayContainNull final Extra<?>... extras); @Nullable static Topic parse(@Nonnull final MindMap map, @Nonnull final MindMapLexer lexer); boolean containTopic(@Nonnull final Topic topic); @Nullable Topic nextSibling(); @Nullable Topic prevSibling(); boolean containsPattern(final @Nullable File baseFolder, final @Nonnull Pattern pattern, final boolean findInTopicText, @Nullable final Set<Extra.ExtraType> extrasForSearch); boolean isRoot(); @Nullable Object getPayload(); void setPayload(@Nullable final Object value); @Nonnull MindMap getMap(); int getTopicLevel(); @Nullable Topic findParentForDepth(int depth); @Nonnull Topic getRoot(); @Nullable Topic getFirst(); @Nullable Topic getLast(); @Nonnull @MustNotContainNull List<Topic> getChildren(); int getNumberOfExtras(); @Nonnull Map<Extra.ExtraType, Extra<?>> getExtras(); @Nonnull @MustNotContainNull Extra<?>[] extrasToArray(); @Nonnull Map<String, String> getAttributes(); @Nonnull Map<String, String> getCodeSnippets(); boolean setAttribute(@Nonnull final String name, @Nullable final String value); boolean setCodeSnippet(@Nonnull final String language, @Nullable final String text); @Nullable String getCodeSnippet(@Nonnull final String language); @Nullable String getAttribute(@Nonnull final String name); void delete(); @Nullable Topic getParent(); @Nonnull String getText(); void setText(@Nonnull final String text); boolean isFirstChild(@Nonnull final Topic t); boolean isLastChild(@Nonnull final Topic t); boolean removeExtra(@Nonnull @MustNotContainNull final Extra.ExtraType... types); void setExtra(@MustNotContainNull @Nonnull final Extra<?>... extras); boolean makeFirst(); boolean hasAncestor(@Nonnull final Topic topic); boolean makeLast(); void moveBefore(@Nonnull final Topic topic); @Nullable String findAttributeInAncestors(@Nonnull final String attrName); void moveAfter(@Nonnull final Topic topic); void write(@Nonnull final Writer out); @Override int hashCode(); @Override boolean equals(@Nonnull final Object topic); @Override @Nonnull String toString(); long getLocalUid(); boolean hasChildren(); void removeAllChildren(); boolean moveToNewParent(@Nullable final Topic newParent); @Nonnull Topic makeChild(@Nullable final String text, @Nullable final Topic afterTheTopic); @Nullable Topic findNext(@Nullable final TopicChecker checker); @Nullable Topic findPrev(@Nonnull final TopicChecker checker); void removeExtras(@Nullable @MayContainNull final Extra<?>... extras); @Nullable Topic findForAttribute(@Nonnull final String attrName, @Nonnull String value); @Nonnull int[] getPositionPath(); @Nonnull @MustNotContainNull Topic[] getPath(); boolean removeExtraFromSubtree(@Nonnull @MustNotContainNull final Extra.ExtraType... type); boolean removeAttributeFromSubtree(@Nonnull @MustNotContainNull final String... names); boolean deleteLinkToFileIfPresented(@Nonnull final File baseFolder, @Nonnull final MMapURI file); boolean replaceLinkToFileIfPresented(@Nonnull final File baseFolder, @Nonnull final MMapURI oldFile, @Nonnull final MMapURI newFile); boolean doesContainFileLink(@Nonnull final File baseFolder, @Nonnull final MMapURI file); @Override @Nonnull Iterator<Topic> iterator(); boolean doesContainCodeSnippetForAnyLanguage(@Nonnull @MustNotContainNull String... languageNames); }
Topic implements Serializable, Constants, Iterable<Topic> { public boolean containsPattern(final @Nullable File baseFolder, final @Nonnull Pattern pattern, final boolean findInTopicText, @Nullable final Set<Extra.ExtraType> extrasForSearch) { boolean result = false; if (findInTopicText && pattern.matcher(this.text).find()) { result = true; } else if (extrasForSearch != null && !extrasForSearch.isEmpty()) { for (final Extra<?> e : this.extras.values()) { if (extrasForSearch.contains(e.getType()) && e.containsPattern(baseFolder, pattern)) { result = true; break; } } } return result; } Topic(@Nonnull final MindMap mindMap, @Nonnull final Topic base, final boolean copyChildren);  Topic(@Nonnull final MindMap map, @Nullable final Topic parent, @Nonnull final String text, @Nonnull @MayContainNull final Extra<?>... extras); private  Topic(@Nonnull final MindMap map, @Nonnull final String text, @Nonnull @MayContainNull final Extra<?>... extras); @Nullable static Topic parse(@Nonnull final MindMap map, @Nonnull final MindMapLexer lexer); boolean containTopic(@Nonnull final Topic topic); @Nullable Topic nextSibling(); @Nullable Topic prevSibling(); boolean containsPattern(final @Nullable File baseFolder, final @Nonnull Pattern pattern, final boolean findInTopicText, @Nullable final Set<Extra.ExtraType> extrasForSearch); boolean isRoot(); @Nullable Object getPayload(); void setPayload(@Nullable final Object value); @Nonnull MindMap getMap(); int getTopicLevel(); @Nullable Topic findParentForDepth(int depth); @Nonnull Topic getRoot(); @Nullable Topic getFirst(); @Nullable Topic getLast(); @Nonnull @MustNotContainNull List<Topic> getChildren(); int getNumberOfExtras(); @Nonnull Map<Extra.ExtraType, Extra<?>> getExtras(); @Nonnull @MustNotContainNull Extra<?>[] extrasToArray(); @Nonnull Map<String, String> getAttributes(); @Nonnull Map<String, String> getCodeSnippets(); boolean setAttribute(@Nonnull final String name, @Nullable final String value); boolean setCodeSnippet(@Nonnull final String language, @Nullable final String text); @Nullable String getCodeSnippet(@Nonnull final String language); @Nullable String getAttribute(@Nonnull final String name); void delete(); @Nullable Topic getParent(); @Nonnull String getText(); void setText(@Nonnull final String text); boolean isFirstChild(@Nonnull final Topic t); boolean isLastChild(@Nonnull final Topic t); boolean removeExtra(@Nonnull @MustNotContainNull final Extra.ExtraType... types); void setExtra(@MustNotContainNull @Nonnull final Extra<?>... extras); boolean makeFirst(); boolean hasAncestor(@Nonnull final Topic topic); boolean makeLast(); void moveBefore(@Nonnull final Topic topic); @Nullable String findAttributeInAncestors(@Nonnull final String attrName); void moveAfter(@Nonnull final Topic topic); void write(@Nonnull final Writer out); @Override int hashCode(); @Override boolean equals(@Nonnull final Object topic); @Override @Nonnull String toString(); long getLocalUid(); boolean hasChildren(); void removeAllChildren(); boolean moveToNewParent(@Nullable final Topic newParent); @Nonnull Topic makeChild(@Nullable final String text, @Nullable final Topic afterTheTopic); @Nullable Topic findNext(@Nullable final TopicChecker checker); @Nullable Topic findPrev(@Nonnull final TopicChecker checker); void removeExtras(@Nullable @MayContainNull final Extra<?>... extras); @Nullable Topic findForAttribute(@Nonnull final String attrName, @Nonnull String value); @Nonnull int[] getPositionPath(); @Nonnull @MustNotContainNull Topic[] getPath(); boolean removeExtraFromSubtree(@Nonnull @MustNotContainNull final Extra.ExtraType... type); boolean removeAttributeFromSubtree(@Nonnull @MustNotContainNull final String... names); boolean deleteLinkToFileIfPresented(@Nonnull final File baseFolder, @Nonnull final MMapURI file); boolean replaceLinkToFileIfPresented(@Nonnull final File baseFolder, @Nonnull final MMapURI oldFile, @Nonnull final MMapURI newFile); boolean doesContainFileLink(@Nonnull final File baseFolder, @Nonnull final MMapURI file); @Override @Nonnull Iterator<Topic> iterator(); boolean doesContainCodeSnippetForAnyLanguage(@Nonnull @MustNotContainNull String... languageNames);  }