I'm a bit stuck on a project.. Basically, I get a directory to scan for files that passes certain filters.
The command files contains lines with filtering (given filters name are stored in an enum file) instructions. like this for example: suffix%txt exec%YES
if that's all, it will return all the files ending with txt (extension) and are executable.. so far no problem.
the problem starts with line like this: suffix%txt exec%YES (on the same line) in this case, it should return all the files that ends with txt OR executable..
I'm splitting the line using String.split("%") and getting it into a map with a key and value, than iterate over each key and checks what filter in the enum it is, and perform the desire checking.
I'm kinda stuck on how to identify that when i have more than 1 filter per line. I tried doing a HashMap with the 1st filter as the key, and the value is a list that contains all the other (using split(" ") for breaking up the filters.. I can't rely on the keys being on the even or odd indexes, because a filter may have another %NOT at the end of it (suffix%txt%NOT) which will return all the files that doesn't end with txt...
Any help would be appreciated! Thanks!