@Test public void testExtractFolders() { List<DiskResource> resources = Arrays.asList(folder1, file1); ArrayList<Folder> expected = Lists.newArrayList(diskResourceUtil.extractFolders(resources)); assertTrue(expected.size() == 1); expected = Lists.newArrayList(diskResourceUtil.extractFolders(Arrays.asList(file1))); assertTrue(expected.size() == 0); }
public <R extends DiskResource> Iterable<Folder> extractFolders(Iterable<R> diskresources) { List<Folder> folders = Lists.newArrayList(); for (DiskResource dr : diskresources) { if (dr instanceof Folder) { folders.add((Folder)dr); } } return folders; }
DiskResourceUtil { public <R extends DiskResource> Iterable<Folder> extractFolders(Iterable<R> diskresources) { List<Folder> folders = Lists.newArrayList(); for (DiskResource dr : diskresources) { if (dr instanceof Folder) { folders.add((Folder)dr); } } return folders; } }
DiskResourceUtil { public <R extends DiskResource> Iterable<Folder> extractFolders(Iterable<R> diskresources) { List<Folder> folders = Lists.newArrayList(); for (DiskResource dr : diskresources) { if (dr instanceof Folder) { folders.add((Folder)dr); } } return folders; } DiskResourceUtil(); }
DiskResourceUtil { public <R extends DiskResource> Iterable<Folder> extractFolders(Iterable<R> diskresources) { List<Folder> folders = Lists.newArrayList(); for (DiskResource dr : diskresources) { if (dr instanceof Folder) { folders.add((Folder)dr); } } return folders; } DiskResourceUtil(); static DiskResourceUtil getInstance(); String parseParent(String path); String parseNameFromPath(String path); List<String> parseNamesFromIdList(Iterable<String> idList); final String appendNameToPath(final String basePath, final String name); String asCommaSeparatedNameList(Iterable<String> idList); boolean isOwner(Iterable<DiskResource> resources); boolean hasOwner(Iterable<DiskResource> resources); boolean isChildOfFolder(Folder parent, DiskResource resource); boolean isDescendantOfFolder(Folder ancestor, Folder folder); boolean isMovable(Folder targetFolder, Iterable<DiskResource> dropData); boolean canUploadTo(DiskResource resource); boolean inTrash(DiskResource resource); boolean containsTrashedResource(List<DiskResource> selectedResources); boolean contains(Iterable<R> selection, R target); boolean containsFolder(Iterable<R> selection); boolean containsFile(Iterable<R> selection); Iterable<File> extractFiles(Iterable<R> diskresources); Iterable<Folder> extractFolders(Iterable<R> diskresources); List<String> asStringIdList(Iterable<R> diskResourceList); List<String> asStringPathList(Iterable<R> diskResourceList); FastMap<TYPE> asStringPathTypeMap(Iterable<R> diskResourceList, TYPE type); Splittable createStringIdListSplittable(Iterable<R> hasIdList); Splittable createSplittableFromStringList(List<String> strings); HasPath getFolderPathFromFile(File file); String formatFileSize(String strSize); Set<File> filterFiles(Iterable<DiskResource> diskResources); Set<Folder> filterFolders(Set<DiskResource> diskResources); boolean isOwner(DiskResource dr); boolean isReadable(DiskResource dr); boolean isWritable(DiskResource dr); boolean checkManifest(Splittable obj); boolean isTreeInfoType(InfoType infoType); boolean isGenomeVizInfoType(InfoType infoType); boolean isEnsemblInfoType(InfoType infoType); boolean isTreeTab(Splittable obj); boolean isGenomeVizTab(Splittable obj); boolean isEnsemblVizTab(Splittable obj); Splittable createStringPathListSplittable(List<HasPath> hasPathList); Splittable createInfoTypeSplittable(String infoType); }
DiskResourceUtil { public <R extends DiskResource> Iterable<Folder> extractFolders(Iterable<R> diskresources) { List<Folder> folders = Lists.newArrayList(); for (DiskResource dr : diskresources) { if (dr instanceof Folder) { folders.add((Folder)dr); } } return folders; } DiskResourceUtil(); static DiskResourceUtil getInstance(); String parseParent(String path); String parseNameFromPath(String path); List<String> parseNamesFromIdList(Iterable<String> idList); final String appendNameToPath(final String basePath, final String name); String asCommaSeparatedNameList(Iterable<String> idList); boolean isOwner(Iterable<DiskResource> resources); boolean hasOwner(Iterable<DiskResource> resources); boolean isChildOfFolder(Folder parent, DiskResource resource); boolean isDescendantOfFolder(Folder ancestor, Folder folder); boolean isMovable(Folder targetFolder, Iterable<DiskResource> dropData); boolean canUploadTo(DiskResource resource); boolean inTrash(DiskResource resource); boolean containsTrashedResource(List<DiskResource> selectedResources); boolean contains(Iterable<R> selection, R target); boolean containsFolder(Iterable<R> selection); boolean containsFile(Iterable<R> selection); Iterable<File> extractFiles(Iterable<R> diskresources); Iterable<Folder> extractFolders(Iterable<R> diskresources); List<String> asStringIdList(Iterable<R> diskResourceList); List<String> asStringPathList(Iterable<R> diskResourceList); FastMap<TYPE> asStringPathTypeMap(Iterable<R> diskResourceList, TYPE type); Splittable createStringIdListSplittable(Iterable<R> hasIdList); Splittable createSplittableFromStringList(List<String> strings); HasPath getFolderPathFromFile(File file); String formatFileSize(String strSize); Set<File> filterFiles(Iterable<DiskResource> diskResources); Set<Folder> filterFolders(Set<DiskResource> diskResources); boolean isOwner(DiskResource dr); boolean isReadable(DiskResource dr); boolean isWritable(DiskResource dr); boolean checkManifest(Splittable obj); boolean isTreeInfoType(InfoType infoType); boolean isGenomeVizInfoType(InfoType infoType); boolean isEnsemblInfoType(InfoType infoType); boolean isTreeTab(Splittable obj); boolean isGenomeVizTab(Splittable obj); boolean isEnsemblVizTab(Splittable obj); Splittable createStringPathListSplittable(List<HasPath> hasPathList); Splittable createInfoTypeSplittable(String infoType);  }