class Snapshot {

    /** Maps directory entry names to last modified times. */
    private final ImmutableMap<Name, FileTime> modifiedTimes;

    Snapshot(Map<Name, FileTime> modifiedTimes) {
      this.modifiedTimes = ImmutableMap.copyOf(modifiedTimes);
    }

    /**
     * Posts events to the given key based on the kinds of events it subscribes to and what events
     * have occurred between this state and the given new state.
     */
    boolean postChanges(Snapshot newState, Key key) {<FILL_FUNCTION_BODY>}
  }

      boolean changesPosted = false;

      if (key.subscribesTo(ENTRY_CREATE)) {
        Set<Name> created =
            Sets.difference(newState.modifiedTimes.keySet(), modifiedTimes.keySet());

        for (Name name : created) {
          key.post(new Event<>(ENTRY_CREATE, 1, pathService.createFileName(name)));
          changesPosted = true;
        }
      }

      if (key.subscribesTo(ENTRY_DELETE)) {
        Set<Name> deleted =
            Sets.difference(modifiedTimes.keySet(), newState.modifiedTimes.keySet());

        for (Name name : deleted) {
          key.post(new Event<>(ENTRY_DELETE, 1, pathService.createFileName(name)));
          changesPosted = true;
        }
      }

      if (key.subscribesTo(ENTRY_MODIFY)) {
        for (Map.Entry<Name, FileTime> entry : modifiedTimes.entrySet()) {
          Name name = entry.getKey();
          FileTime modifiedTime = entry.getValue();

          FileTime newModifiedTime = newState.modifiedTimes.get(name);
          if (newModifiedTime != null && !modifiedTime.equals(newModifiedTime)) {
            key.post(new Event<>(ENTRY_MODIFY, 1, pathService.createFileName(name)));
            changesPosted = true;
          }
        }
      }

      return changesPosted;
    
<methods>public void cancelled(com.google.common.jimfs.AbstractWatchService.Key) ,public void close() ,public boolean isOpen() ,public java.nio.file.WatchKey poll() ,public java.nio.file.WatchKey poll(long, java.util.concurrent.TimeUnit) throws java.lang.InterruptedException,public com.google.common.jimfs.AbstractWatchService.Key register(java.nio.file.Watchable, Iterable<? extends Kind<?>>) throws java.io.IOException,public java.nio.file.WatchKey take() throws java.lang.InterruptedException<variables>private final java.util.concurrent.atomic.AtomicBoolean open,private final java.nio.file.WatchKey poison,private final BlockingQueue<java.nio.file.WatchKey> queue