code: private final static Func1<WatchEvent<?>, Boolean> onlyRelatedTo(final File file) {
          return new Func1<WatchEvent<?>, Boolean>() {
  
              @Override
              public Boolean call(WatchEvent<?> event) {
  
                  final boolean ok;
                  if (file.isDirectory())
                      ok = true;
                  else if (StandardWatchEventKinds.OVERFLOW.equals(event.kind()))
                      ok = true;
                  else {
                      Object context = event.context();
                      if (context != null && context instanceof Path) {
                          Path p = (Path) context;
                          Path basePath = getBasePath(file);
                          File pFile = new File(basePath.toFile(), p.toString());
                          ok = pFile.getAbsolutePath().equals(file.getAbsolutePath());
                      } else
                          ok = false;
                  }
                  return ok;
              }
          };
      }
docs: Returns true if and only if the path corresponding to a WatchEvent
  represents the given file. This will be the case for Create, Modify,
  Delete events.
  
  @param file
  the file to restrict events to
  @return predicate