@Test public void testFindNext_Null() throws Exception { final MindMap map = new MindMap(new StringReader("test\n---\n# Solar\n## Mercury\n## Venus\n## Earth\n### Moon\n## Mars\n### Phobos\n### Deimos")); assertEquals("Mercury",map.findNext(null, null, Pattern.compile(Pattern.quote("cury")), true, null).getText()); }
@Nullable public Topic findNext(@Nullable final File baseFolder, @Nullable final Topic start, @Nonnull final Pattern pattern, final boolean findInTopicText, @Nullable final Set<Extra.ExtraType> extrasToFind) { if (start != null && start.getMap() != this) { throw new IllegalArgumentException("Topic doesn't belong to the mind map"); } Topic result = null; this.locker.lock(); try { boolean startFound = start == null; for (final Topic t : this) { if (startFound) { if (t.containsPattern(baseFolder, pattern, findInTopicText, extrasToFind)) { result = t; break; } } else if (t == start) { startFound = true; } } } finally { this.locker.unlock(); } return result; }
MindMap implements Serializable, Constants, Iterable<Topic> { @Nullable public Topic findNext(@Nullable final File baseFolder, @Nullable final Topic start, @Nonnull final Pattern pattern, final boolean findInTopicText, @Nullable final Set<Extra.ExtraType> extrasToFind) { if (start != null && start.getMap() != this) { throw new IllegalArgumentException("Topic doesn't belong to the mind map"); } Topic result = null; this.locker.lock(); try { boolean startFound = start == null; for (final Topic t : this) { if (startFound) { if (t.containsPattern(baseFolder, pattern, findInTopicText, extrasToFind)) { result = t; break; } } else if (t == start) { startFound = true; } } } finally { this.locker.unlock(); } return result; } }
MindMap implements Serializable, Constants, Iterable<Topic> { @Nullable public Topic findNext(@Nullable final File baseFolder, @Nullable final Topic start, @Nonnull final Pattern pattern, final boolean findInTopicText, @Nullable final Set<Extra.ExtraType> extrasToFind) { if (start != null && start.getMap() != this) { throw new IllegalArgumentException("Topic doesn't belong to the mind map"); } Topic result = null; this.locker.lock(); try { boolean startFound = start == null; for (final Topic t : this) { if (startFound) { if (t.containsPattern(baseFolder, pattern, findInTopicText, extrasToFind)) { result = t; break; } } else if (t == start) { startFound = true; } } } finally { this.locker.unlock(); } return result; } MindMap(final boolean makeRoot);  MindMap(@Nonnull final MindMap map);  MindMap(@Nonnull final Reader reader); }
MindMap implements Serializable, Constants, Iterable<Topic> { @Nullable public Topic findNext(@Nullable final File baseFolder, @Nullable final Topic start, @Nonnull final Pattern pattern, final boolean findInTopicText, @Nullable final Set<Extra.ExtraType> extrasToFind) { if (start != null && start.getMap() != this) { throw new IllegalArgumentException("Topic doesn't belong to the mind map"); } Topic result = null; this.locker.lock(); try { boolean startFound = start == null; for (final Topic t : this) { if (startFound) { if (t.containsPattern(baseFolder, pattern, findInTopicText, extrasToFind)) { result = t; break; } } else if (t == start) { startFound = true; } } } finally { this.locker.unlock(); } return result; } MindMap(final boolean makeRoot);  MindMap(@Nonnull final MindMap map);  MindMap(@Nonnull final Reader reader); void clear(); @Nullable Topic findNext(@Nullable final File baseFolder, @Nullable final Topic start, @Nonnull final Pattern pattern, final boolean findInTopicText, @Nullable final Set<Extra.ExtraType> extrasToFind); @Nullable Topic findPrev(@Nullable final File baseFolder, @Nullable final Topic start, @Nonnull final Pattern pattern, final boolean findInTopicText, @Nullable final Set<Extra.ExtraType> extrasForSearch); void setRoot(@Nullable final Topic newRoot, final boolean makeNotification); @Override @Nonnull Iterator<Topic> iterator(); boolean isEmpty(); @Nullable String getAttribute(@Nonnull final String name); void setAttribute(@Nonnull final String name, @Nullable final String value); void resetPayload(); @Nullable Topic findForPositionPath(@Nullable final int[] positions); @Nonnull @MustNotContainNull List<Topic> removeNonExistingTopics(@Nonnull @MustNotContainNull final List<Topic> origList); @Nullable Topic getRoot(); @Override @Nonnull String toString(); @Nonnull String packToString(); @Nonnull T write(@Nonnull final T out); void lock(); void unlock(); @Nullable Topic cloneTopic(@Nullable final Topic topic, final boolean cloneFullTree); boolean removeTopic(@Nullable final Topic topic); @Nullable Topic findTopicForLink(@Nullable final ExtraTopic link); @Nonnull @MustNotContainNull List<Topic> findAllTopicsForExtraType(@Nonnull final Extra.ExtraType type); @Nonnull Topic getChild(@Nonnull final Topic parent, final int index); int getChildCount(@Nonnull Topic parent); boolean isLeaf(@Nonnull final Topic node); void valueForPathChanged(@Nonnull @MustNotContainNull final Topic[] path, @Nullable final String newValue); int getIndexOfChild(@Nonnull final Topic parent, @Nullable final Topic child); void addMindMapModelEventListener(@Nonnull final MindMapModelEventListener l); void removeMindMapModelEventListener(@Nonnull final MindMapModelEventListener l); boolean doesContainFileLink(@Nonnull final File baseFolder, @Nonnull final MMapURI file); boolean deleteAllLinksToFile(@Nonnull final File baseFolder, @Nonnull final MMapURI file); boolean replaceAllLinksToFile(@Nonnull final File baseFolder, @Nonnull final MMapURI oldFile, @Nonnull final MMapURI newFile); @Nonnull @MustNotContainNull List<Topic> makePlainList(); }
MindMap implements Serializable, Constants, Iterable<Topic> { @Nullable public Topic findNext(@Nullable final File baseFolder, @Nullable final Topic start, @Nonnull final Pattern pattern, final boolean findInTopicText, @Nullable final Set<Extra.ExtraType> extrasToFind) { if (start != null && start.getMap() != this) { throw new IllegalArgumentException("Topic doesn't belong to the mind map"); } Topic result = null; this.locker.lock(); try { boolean startFound = start == null; for (final Topic t : this) { if (startFound) { if (t.containsPattern(baseFolder, pattern, findInTopicText, extrasToFind)) { result = t; break; } } else if (t == start) { startFound = true; } } } finally { this.locker.unlock(); } return result; } MindMap(final boolean makeRoot);  MindMap(@Nonnull final MindMap map);  MindMap(@Nonnull final Reader reader); void clear(); @Nullable Topic findNext(@Nullable final File baseFolder, @Nullable final Topic start, @Nonnull final Pattern pattern, final boolean findInTopicText, @Nullable final Set<Extra.ExtraType> extrasToFind); @Nullable Topic findPrev(@Nullable final File baseFolder, @Nullable final Topic start, @Nonnull final Pattern pattern, final boolean findInTopicText, @Nullable final Set<Extra.ExtraType> extrasForSearch); void setRoot(@Nullable final Topic newRoot, final boolean makeNotification); @Override @Nonnull Iterator<Topic> iterator(); boolean isEmpty(); @Nullable String getAttribute(@Nonnull final String name); void setAttribute(@Nonnull final String name, @Nullable final String value); void resetPayload(); @Nullable Topic findForPositionPath(@Nullable final int[] positions); @Nonnull @MustNotContainNull List<Topic> removeNonExistingTopics(@Nonnull @MustNotContainNull final List<Topic> origList); @Nullable Topic getRoot(); @Override @Nonnull String toString(); @Nonnull String packToString(); @Nonnull T write(@Nonnull final T out); void lock(); void unlock(); @Nullable Topic cloneTopic(@Nullable final Topic topic, final boolean cloneFullTree); boolean removeTopic(@Nullable final Topic topic); @Nullable Topic findTopicForLink(@Nullable final ExtraTopic link); @Nonnull @MustNotContainNull List<Topic> findAllTopicsForExtraType(@Nonnull final Extra.ExtraType type); @Nonnull Topic getChild(@Nonnull final Topic parent, final int index); int getChildCount(@Nonnull Topic parent); boolean isLeaf(@Nonnull final Topic node); void valueForPathChanged(@Nonnull @MustNotContainNull final Topic[] path, @Nullable final String newValue); int getIndexOfChild(@Nonnull final Topic parent, @Nullable final Topic child); void addMindMapModelEventListener(@Nonnull final MindMapModelEventListener l); void removeMindMapModelEventListener(@Nonnull final MindMapModelEventListener l); boolean doesContainFileLink(@Nonnull final File baseFolder, @Nonnull final MMapURI file); boolean deleteAllLinksToFile(@Nonnull final File baseFolder, @Nonnull final MMapURI file); boolean replaceAllLinksToFile(@Nonnull final File baseFolder, @Nonnull final MMapURI oldFile, @Nonnull final MMapURI newFile); @Nonnull @MustNotContainNull List<Topic> makePlainList(); static final String FORMAT_VERSION; }