// Path: jpathwatch-java/src/main/java/name/pachler/nio/file/Path.java
// public abstract class Path implements Watchable {
// 
// 	protected Path(){
// 	}
// 
// 	@Override
// 	public abstract boolean equals(Object obj);
// 
// 	@Override
// 	public abstract int hashCode();
// 
// 	public abstract WatchKey register(WatchService watcher, Kind<?>... events) throws IOException;
// 
// 	public abstract WatchKey register(WatchService watcher, Kind<?>[] events, Modifier... modifiers) throws IOException;
// 
// 	public abstract Path resolve(Path other);
// 
// 	@Override
// 	public abstract String toString();
// 
// }
// 
// Path: jpathwatch-java/src/main/java/name/pachler/nio/file/StandardWatchEventKind.java
// public class StandardWatchEventKind {
// 	/**
// 	 * Indicates that a file has been created under the watched path.
// 	 */
// 	public static final WatchEvent.Kind<Path> 	ENTRY_CREATE = new PathWatchEventKind("ENTRY_CREATE");
// 	/**
// 	 * Indicates that a file has been deleted under the watched path. Note that
// 	 * on file rename the old file name will be reported as deleted if no other
// 	 * (extended) watch event kinds are specified.
// 	 * @see ExtendedWatchEventKind
// 	 */
// 	public static final WatchEvent.Kind<Path> 	ENTRY_DELETE = new PathWatchEventKind("ENTRY_DELETE");
// 	/**
// 	 * Indicates that a file under the watched path has been modified. Note that
// 	 * modification can never be byte-accurate, which means that you won't
// 	 * receive a modification event for each byte written to a file. It is
// 	 * higly implementation dependent how many modification events are produced.
// 	 */
// 	public static final WatchEvent.Kind<Path> 	ENTRY_MODIFY = new PathWatchEventKind("ENTRY_MODIFY");
// 
// 	/**
// 	 * Indicates queue overflow in the WatchService. If the event queue
// 	 * overflows (because, for example,the WatchService runs
// 	 * out of space to store events because they occur faster than the client
// 	 * code can retreives them from the designated watch keys), additional
// 	 * events are dropped, and this event is reported.
// 	 * Note that WatchKeys are always subscribed to this event, regardless
// 	 * of whether it is specified to <code>register()</code> or not.
// 	 * @see Watchable#register
// 	 */
// 	public static final WatchEvent.Kind<Void> 	OVERFLOW = new VoidWatchEventKind("OVERFLOW");
// }


import java.io.File;
import java.io.FileNotFoundException;
import java.util.Arrays;
import name.pachler.nio.file.Path;
import name.pachler.nio.file.StandardWatchEventKind;
			} else if(comparison > 0){
				// we have a file on the new side that wasn't on the old side
				// before - so it must have been created.
				if((flags & PathWatchService.FLAG_FILTER_ENTRY_CREATE)!=0){
					Path p = new PathImpl(new File(newName));
					PathWatchEvent e = new PathWatchEvent(StandardWatchEventKind.ENTRY_CREATE, p, 1);
					addWatchEvent(e);
				}
				// also check if the size is > 0, which indicates that it
				// was written to as well after it has been created - so we
				// have to report ENTRY_MODIFY too in this case.
				if((flags & PathWatchService.FLAG_FILTER_ENTRY_MODIFY)!= 0 ){
					long newLength = newLengths[newIndex];
					if(newLength > 0){
						Path p = new PathImpl(new File(newName));
						PathWatchEvent e = new PathWatchEvent(StandardWatchEventKind.ENTRY_MODIFY, p, 1);
						addWatchEvent(e);
					}
				}
				++newIndex;
			} else {

				if((flags & PathWatchService.FLAG_FILTER_ENTRY_MODIFY)!= 0 ){
					long lastModified = lastModifieds[oldIndex];
					long newLastModified = newLastModifieds[newIndex];
					long length = lengths[oldIndex];
					long newLength = newLengths[newIndex];

					if(lastModified != newLastModified || length != newLength){
						Path p = new PathImpl(new File(newName));
// Path: jpathwatch-java/src/main/java/name/pachler/nio/file/Path.java
// public abstract class Path implements Watchable {
// 
// 	protected Path(){
// 	}
// 
// 	@Override
// 	public abstract boolean equals(Object obj);
// 
// 	@Override
// 	public abstract int hashCode();
// 
// 	public abstract WatchKey register(WatchService watcher, Kind<?>... events) throws IOException;
// 
// 	public abstract WatchKey register(WatchService watcher, Kind<?>[] events, Modifier... modifiers) throws IOException;
// 
// 	public abstract Path resolve(Path other);
// 
// 	@Override
// 	public abstract String toString();
// 
// }
// 
// Path: jpathwatch-java/src/main/java/name/pachler/nio/file/StandardWatchEventKind.java
// public class StandardWatchEventKind {
// 	/**
// 	 * Indicates that a file has been created under the watched path.
// 	 */
// 	public static final WatchEvent.Kind<Path> 	ENTRY_CREATE = new PathWatchEventKind("ENTRY_CREATE");
// 	/**
// 	 * Indicates that a file has been deleted under the watched path. Note that
// 	 * on file rename the old file name will be reported as deleted if no other
// 	 * (extended) watch event kinds are specified.
// 	 * @see ExtendedWatchEventKind
// 	 */
// 	public static final WatchEvent.Kind<Path> 	ENTRY_DELETE = new PathWatchEventKind("ENTRY_DELETE");
// 	/**
// 	 * Indicates that a file under the watched path has been modified. Note that
// 	 * modification can never be byte-accurate, which means that you won't
// 	 * receive a modification event for each byte written to a file. It is
// 	 * higly implementation dependent how many modification events are produced.
// 	 */
// 	public static final WatchEvent.Kind<Path> 	ENTRY_MODIFY = new PathWatchEventKind("ENTRY_MODIFY");
// 
// 	/**
// 	 * Indicates queue overflow in the WatchService. If the event queue
// 	 * overflows (because, for example,the WatchService runs
// 	 * out of space to store events because they occur faster than the client
// 	 * code can retreives them from the designated watch keys), additional
// 	 * events are dropped, and this event is reported.
// 	 * Note that WatchKeys are always subscribed to this event, regardless
// 	 * of whether it is specified to <code>register()</code> or not.
// 	 * @see Watchable#register
// 	 */
// 	public static final WatchEvent.Kind<Void> 	OVERFLOW = new VoidWatchEventKind("OVERFLOW");
// }


// Path: jpathwatch-java/src/main/java/name/pachler/nio/file/impl/PollingPathWatchKey.java
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Arrays;
import name.pachler.nio.file.Path;
import name.pachler.nio.file.StandardWatchEventKind;

			} else if(comparison > 0){
				// we have a file on the new side that wasn't on the old side
				// before - so it must have been created.
				if((flags & PathWatchService.FLAG_FILTER_ENTRY_CREATE)!=0){
					Path p = new PathImpl(new File(newName));
					PathWatchEvent e = new PathWatchEvent(StandardWatchEventKind.ENTRY_CREATE, p, 1);
					addWatchEvent(e);
				}
				// also check if the size is > 0, which indicates that it
				// was written to as well after it has been created - so we
				// have to report ENTRY_MODIFY too in this case.
				if((flags & PathWatchService.FLAG_FILTER_ENTRY_MODIFY)!= 0 ){
					long newLength = newLengths[newIndex];
					if(newLength > 0){
						Path p = new PathImpl(new File(newName));
						PathWatchEvent e = new PathWatchEvent(StandardWatchEventKind.ENTRY_MODIFY, p, 1);
						addWatchEvent(e);
					}
				}
				++newIndex;
			} else {

				if((flags & PathWatchService.FLAG_FILTER_ENTRY_MODIFY)!= 0 ){
					long lastModified = lastModifieds[oldIndex];
					long newLastModified = newLastModifieds[newIndex];
					long length = lengths[oldIndex];
					long newLength = newLengths[newIndex];

					if(lastModified != newLastModified || length != newLength){
						Path p = new PathImpl(new File(newName));
						PathWatchEvent e = new PathWatchEvent(StandardWatchEventKind.ENTRY_MODIFY, p, 1);