SearchFoldersByRegex - ViiSE/papka GitHub Wiki
SearchFoldersByRegex<T> - search folders by regular expression.
public SearchFoldersByRegex(Folder<T> folder, boolean isFullName)
Folder<T> folder - folder to search in;
boolean isFullName - is the search for the full folders name or not? (default true)
public SearchFoldersByRegex(Folder<T> folder)
Folder<T> folder - folder to search in.
List<String> rootFiles = new ArrayList<>();
rootFiles.add("root1.png");
rootFiles.add("root2.pdf");
List<String> child1Files = new ArrayList<>();
child1Files.add("child1.txt");
child1Files.add("child1.png");
List<String> musicFiles = new ArrayList<>();
child2Files.add("sound1.mp3");
child2Files.add("sound2.mp3");
Folder<String> root = new FolderPure<>(
new NameFolderRoot(),
rootFiles,
new FolderPure<>(
"/child1",
child1Files),
new FolderPure<>(
"/music",
musicFiles));
SearchFolders<String, String> search = new SearchFoldersByRegex<>(root);
List<Folder<String>> actual = search.answer("/music");
System.out.println(folder.fullName());
System.out.println(folder.shortName());
folder.files().forEach(file -> System.out.println("\t" + file));
Output:
/music
music
sound1.mp3
sound2.mp3
SearchFolders - implementable interface.