1

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

Octavius
  • 583
  • 5
  • 19

2 Answers2

2

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.

mbinette
  • 5,094
  • 3
  • 24
  • 32
1

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.

John Woo
  • 258,903
  • 69
  • 498
  • 492