@Test public void testFindDocument() { for (boolean absolutePath : new boolean[] { true, false }) { String prefix = absolutePath ? "/" : ""; FileFolder f1 = new FileFolder(new Path(prefix + "one"), null); FileFolder f2 = new FileFolder(f1, "two", null); FileDocument doc = new FileDocument(f2, "three", 1L); String targetPath = prefix + "one/two/three"; assertTrue(doc == f1.findTreeNode(new Path(targetPath))); String wrongPrefix = absolutePath ? "" : "/"; String wrongPath = wrongPrefix + "one/two/three"; assertNull(f1.findTreeNode(new Path(wrongPath))); assertNull(f1.findTreeNode(new Path(prefix + "does/not/exist"))); } }
@Nullable @ThreadSafe public final TreeNode findTreeNode(@NotNull Path targetPath) { Util.checkNotNull(targetPath); if (getPath().equals(targetPath)) return this; return findTreeNodeUnchecked(targetPath); }
Folder extends TreeNode implements ViewNode { @Nullable @ThreadSafe public final TreeNode findTreeNode(@NotNull Path targetPath) { Util.checkNotNull(targetPath); if (getPath().equals(targetPath)) return this; return findTreeNodeUnchecked(targetPath); } }
Folder extends TreeNode implements ViewNode { @Nullable @ThreadSafe public final TreeNode findTreeNode(@NotNull Path targetPath) { Util.checkNotNull(targetPath); if (getPath().equals(targetPath)) return this; return findTreeNodeUnchecked(targetPath); } @SuppressWarnings("unchecked") protected  Folder(	@NotNull F parent,
						@NotNull String name,
						@Nullable Long lastModified); protected  Folder(@NotNull Path path, @Nullable Long lastModified); }
Folder extends TreeNode implements ViewNode { @Nullable @ThreadSafe public final TreeNode findTreeNode(@NotNull Path targetPath) { Util.checkNotNull(targetPath); if (getPath().equals(targetPath)) return this; return findTreeNodeUnchecked(targetPath); } @SuppressWarnings("unchecked") protected  Folder(	@NotNull F parent,
						@NotNull String name,
						@Nullable Long lastModified); protected  Folder(@NotNull Path path, @Nullable Long lastModified); final synchronized int getParentCount(); @Nullable synchronized final F getParent(); @Nullable @RecursiveMethod @SuppressWarnings("unchecked") synchronized final F getRoot(); @SuppressWarnings("unchecked") @NotNull synchronized final Path getPath(); @Nullable synchronized final Long getLastModified(); synchronized final void setLastModified(@Nullable Long lastModified); @SuppressWarnings("unchecked") synchronized final void putDocument(@NotNull D doc); @SuppressWarnings("unchecked") final void putSubFolder(@NotNull F subFolder); synchronized final void removeDocument(@Nullable D doc); final void removeChildren(); final void removeSubFolder(@Nullable F subFolder); synchronized final void removeDocuments(@NotNull Predicate<D> predicate); synchronized final void removeSubFolders(@NotNull Predicate<F> predicate); @Nullable synchronized final D getDocument(String name); synchronized final int getDocumentCount(); @ImmutableCopy @NotNull synchronized final List<D> getDocuments(); @ImmutableCopy @NotNull synchronized final Map<String, D> getDocumentMap(); @MutableCopy @NotNull @SuppressWarnings("unchecked") synchronized final List<D> getDocumentsDeep(); @Nullable synchronized final F getSubFolder(String name); synchronized final int getSubFolderCount(); @ImmutableCopy @NotNull synchronized final List<F> getSubFolders(); @ImmutableCopy @NotNull synchronized final Map<String, F> getSubFolderMap(); synchronized final int getChildCount(); @ImmutableCopy @NotNull synchronized final Iterable<ViewNode> getChildren(); synchronized final boolean isChecked(); synchronized final void setChecked(boolean isChecked); @NotNull @SuppressWarnings("unchecked") synchronized final TreeCheckState getTreeCheckState(); final boolean isIndex(); @ImmutableCopy @NotNull synchronized final List<String> getDocumentIds(); @Nullable @ThreadSafe final TreeNode findTreeNode(@NotNull Path targetPath); synchronized final boolean hasErrorsDeep(); }
Folder extends TreeNode implements ViewNode { @Nullable @ThreadSafe public final TreeNode findTreeNode(@NotNull Path targetPath) { Util.checkNotNull(targetPath); if (getPath().equals(targetPath)) return this; return findTreeNodeUnchecked(targetPath); } @SuppressWarnings("unchecked") protected  Folder(	@NotNull F parent,
						@NotNull String name,
						@Nullable Long lastModified); protected  Folder(@NotNull Path path, @Nullable Long lastModified); final synchronized int getParentCount(); @Nullable synchronized final F getParent(); @Nullable @RecursiveMethod @SuppressWarnings("unchecked") synchronized final F getRoot(); @SuppressWarnings("unchecked") @NotNull synchronized final Path getPath(); @Nullable synchronized final Long getLastModified(); synchronized final void setLastModified(@Nullable Long lastModified); @SuppressWarnings("unchecked") synchronized final void putDocument(@NotNull D doc); @SuppressWarnings("unchecked") final void putSubFolder(@NotNull F subFolder); synchronized final void removeDocument(@Nullable D doc); final void removeChildren(); final void removeSubFolder(@Nullable F subFolder); synchronized final void removeDocuments(@NotNull Predicate<D> predicate); synchronized final void removeSubFolders(@NotNull Predicate<F> predicate); @Nullable synchronized final D getDocument(String name); synchronized final int getDocumentCount(); @ImmutableCopy @NotNull synchronized final List<D> getDocuments(); @ImmutableCopy @NotNull synchronized final Map<String, D> getDocumentMap(); @MutableCopy @NotNull @SuppressWarnings("unchecked") synchronized final List<D> getDocumentsDeep(); @Nullable synchronized final F getSubFolder(String name); synchronized final int getSubFolderCount(); @ImmutableCopy @NotNull synchronized final List<F> getSubFolders(); @ImmutableCopy @NotNull synchronized final Map<String, F> getSubFolderMap(); synchronized final int getChildCount(); @ImmutableCopy @NotNull synchronized final Iterable<ViewNode> getChildren(); synchronized final boolean isChecked(); synchronized final void setChecked(boolean isChecked); @NotNull @SuppressWarnings("unchecked") synchronized final TreeCheckState getTreeCheckState(); final boolean isIndex(); @ImmutableCopy @NotNull synchronized final List<String> getDocumentIds(); @Nullable @ThreadSafe final TreeNode findTreeNode(@NotNull Path targetPath); synchronized final boolean hasErrorsDeep(); static final Event<FolderEvent> evtFolderAdding; static final Event<FolderEvent> evtFolderAdded; static final Event<FolderEvent> evtFolderRemoved; }