What does !FILTERs mean?
-
03-07-2021 - |
Question
I have recently implemented Crawler4j and I am trying to teach myself the code by breaking it down line by line. I am having trouble understanding what the !FILTERS object on the line of code below means.
@Override
public boolean shouldVisit(WebURL url) {
String href = url.getURL().toLowerCase();
return !FILTERS.matcher(href).matches() && href.startsWith("http://www.ics.uci.edu/");
}
It would be greatly appreciated if someone helped me understand !FILTERS
Solution
It is simply a negation of a condition... You should read it like this:
! ( FILTERS.matcher(href).matches() ) [...]
Basically, if the filters don't match the href, AND that the href starts with "http://www.ics.uci.edu/", that function would return true.
OTHER TIPS
The opposite value of FILTERS.matcher(href).matches()
. basically exclamation point is also called negate
sign.
if this condition: FILTERS.matcher(href).matches()
returns true, it changes it to false.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow