// 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/WatchEvent.java
// public abstract class WatchEvent<T> {
// 	/**
// 	 * Instances of this class act as tags to identify different kinds of
// 	 * events (like file creation or deletion)
// 	 * @param <T> The context this kind is intended for. In jpathwatch, only
// 	 * Path and Void are used as context types.
// 	 */
//     public static interface Kind<T>
//     {
// 		/**
// 		 * @return the name of this modifier
// 		 */
// 		String name();
// 		/**
// 		 * @return the type of the WatchEvent's context value.
// 		 */
// 		Class<T> type();
//     }
// 
// 	/**
// 	 * A modifier can be specified to {@link Watchable#register register} to
// 	 * change the way changes to a watchable are reported. jpathwatch
// 	 * defines a set of modifiers in the {@link ExtendedWatchEventModifier}
// 	 * class.
// 	 * @param <T> The context type for the modifier.
// 	 * @see ExtendedWatchEventModifier
// 	 */
//     public static interface Modifier<T>
//     {
// 		/**
// 		 * The modifier's name should be used for informative purposes
// 		 * only (like error reporting).
// 		 * @return	the modifier's name
// 		 */
// 		String name();
//     }
// 
//     protected WatchEvent()
//     {}
// 
// 	/**
// 	 * @return the context of this event, which is usually a reference to the
// 	 * object that has changed. In the case of WatchEvents for Path, the
// 	 * context will be a <code>Path</code> to the file that this event
// 	 * refers to, relative to the watched <code>Path</code>
// 	 */
//     public abstract T context();
// 	/**
// 	 * The number of times this event occurred, if it is cumulative. It
// 	 * is not specified how events cumulate, so use this value for informational
// 	 * purposes only.
// 	 * @return the number of times this event has occurred, in case events of
// 	 *	this kind have been aggregated into one WatchEvent instance.
// 	 */
//     public abstract int count();
// 
// 	/**
// 	 * @return the kind of event that occurred. This will indicate what
// 	 * actually happened, for instance, StandardWatchEventKind#ENTRY_CREATE
// 	 * indicates that a file has been created.
// 	 */
//     public abstract WatchEvent.Kind<T> kind();
// }
// 
// Path: jpathwatch-java/src/main/java/name/pachler/nio/file/WatchKey.java
// public abstract class WatchKey {
// protected 	WatchKey()
// {}
// /**
//  * This cancels the registration with the WatchService that this WatchKey
//  * was registered with. This means that no new events will be delivered to this
//  * key any more. Events that are pending can still be retreived with
//  * pollEvents(), and if the WatchKey is still marked as signalled a call to
//  * WatchService's poll() or take() functions will still return it.
//  */
// public abstract  void 	cancel();
// 
// /**
//  * @return if this watch key is valid. A watch key is valid if
//  * <ul>
//  * <li>It has not been canceled</li>
//  * <li>The WatchService is not yet closed</li>
//  * </ul>
//  */
// public abstract  boolean 	isValid();
// 
// /**
//  * Returns the events that have occurred for this WatchKey. Just calling
//  * this method will not reset the signalled state of this key; you'll have
//  * to call #reset() to indicate to the WatchService that the the client is
//  * ready to receive more events and that the key can be re-queued.
//  * After the WatchService has determined that events have occurred for a
//  * registered Watchable represented by a given WatchKey, it will return that
//  * key when the client calls it's WatchService#take() or WatchService#poll()
//  * methods.
//  * @return	a list of events that have occurred since the last time that
//  *	#pollEvents() was called.
//  */
// public abstract  List<WatchEvent<?>> 	pollEvents();
// 
// /**
//  * Resets this {@link WatchKey} (marks it as non-signalled) so that it's
//  * corresponding {@link WatchService} can report it again via it's
//  * {@link WatchService#poll} and {@link WatchService#take} methods.
//  *
//  * @return <code>true</code> if the key could be reset, <code>false</code>
//  * otherwise (typically if the corresponding {@link WatchService} has been closed
//  * or if the the key was not signalled).
//  */
// public abstract  boolean 	reset();
// }


import name.pachler.nio.file.Path;
import java.util.List;
import java.util.Vector;
import name.pachler.nio.file.WatchEvent;
import name.pachler.nio.file.WatchKey;
/*
 * Copyright 2008-2011 Uwe Pachler
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation. This particular file is
 * subject to the "Classpath" exception as provided in the LICENSE file
 * that accompanied this code.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 */

package name.pachler.nio.file.impl;


/**
 *
 * @author count
 */
public class PathWatchKey extends WatchKey {
	private int flags;
	private PathWatchService service;
// 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/WatchEvent.java
// public abstract class WatchEvent<T> {
// 	/**
// 	 * Instances of this class act as tags to identify different kinds of
// 	 * events (like file creation or deletion)
// 	 * @param <T> The context this kind is intended for. In jpathwatch, only
// 	 * Path and Void are used as context types.
// 	 */
//     public static interface Kind<T>
//     {
// 		/**
// 		 * @return the name of this modifier
// 		 */
// 		String name();
// 		/**
// 		 * @return the type of the WatchEvent's context value.
// 		 */
// 		Class<T> type();
//     }
// 
// 	/**
// 	 * A modifier can be specified to {@link Watchable#register register} to
// 	 * change the way changes to a watchable are reported. jpathwatch
// 	 * defines a set of modifiers in the {@link ExtendedWatchEventModifier}
// 	 * class.
// 	 * @param <T> The context type for the modifier.
// 	 * @see ExtendedWatchEventModifier
// 	 */
//     public static interface Modifier<T>
//     {
// 		/**
// 		 * The modifier's name should be used for informative purposes
// 		 * only (like error reporting).
// 		 * @return	the modifier's name
// 		 */
// 		String name();
//     }
// 
//     protected WatchEvent()
//     {}
// 
// 	/**
// 	 * @return the context of this event, which is usually a reference to the
// 	 * object that has changed. In the case of WatchEvents for Path, the
// 	 * context will be a <code>Path</code> to the file that this event
// 	 * refers to, relative to the watched <code>Path</code>
// 	 */
//     public abstract T context();
// 	/**
// 	 * The number of times this event occurred, if it is cumulative. It
// 	 * is not specified how events cumulate, so use this value for informational
// 	 * purposes only.
// 	 * @return the number of times this event has occurred, in case events of
// 	 *	this kind have been aggregated into one WatchEvent instance.
// 	 */
//     public abstract int count();
// 
// 	/**
// 	 * @return the kind of event that occurred. This will indicate what
// 	 * actually happened, for instance, StandardWatchEventKind#ENTRY_CREATE
// 	 * indicates that a file has been created.
// 	 */
//     public abstract WatchEvent.Kind<T> kind();
// }
// 
// Path: jpathwatch-java/src/main/java/name/pachler/nio/file/WatchKey.java
// public abstract class WatchKey {
// protected 	WatchKey()
// {}
// /**
//  * This cancels the registration with the WatchService that this WatchKey
//  * was registered with. This means that no new events will be delivered to this
//  * key any more. Events that are pending can still be retreived with
//  * pollEvents(), and if the WatchKey is still marked as signalled a call to
//  * WatchService's poll() or take() functions will still return it.
//  */
// public abstract  void 	cancel();
// 
// /**
//  * @return if this watch key is valid. A watch key is valid if
//  * <ul>
//  * <li>It has not been canceled</li>
//  * <li>The WatchService is not yet closed</li>
//  * </ul>
//  */
// public abstract  boolean 	isValid();
// 
// /**
//  * Returns the events that have occurred for this WatchKey. Just calling
//  * this method will not reset the signalled state of this key; you'll have
//  * to call #reset() to indicate to the WatchService that the the client is
//  * ready to receive more events and that the key can be re-queued.
//  * After the WatchService has determined that events have occurred for a
//  * registered Watchable represented by a given WatchKey, it will return that
//  * key when the client calls it's WatchService#take() or WatchService#poll()
//  * methods.
//  * @return	a list of events that have occurred since the last time that
//  *	#pollEvents() was called.
//  */
// public abstract  List<WatchEvent<?>> 	pollEvents();
// 
// /**
//  * Resets this {@link WatchKey} (marks it as non-signalled) so that it's
//  * corresponding {@link WatchService} can report it again via it's
//  * {@link WatchService#poll} and {@link WatchService#take} methods.
//  *
//  * @return <code>true</code> if the key could be reset, <code>false</code>
//  * otherwise (typically if the corresponding {@link WatchService} has been closed
//  * or if the the key was not signalled).
//  */
// public abstract  boolean 	reset();
// }


// Path: jpathwatch-java/src/main/java/name/pachler/nio/file/impl/PathWatchKey.java
import name.pachler.nio.file.Path;
import java.util.List;
import java.util.Vector;
import name.pachler.nio.file.WatchEvent;
import name.pachler.nio.file.WatchKey;

/*
 * Copyright 2008-2011 Uwe Pachler
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation. This particular file is
 * subject to the "Classpath" exception as provided in the LICENSE file
 * that accompanied this code.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 */

package name.pachler.nio.file.impl;


/**
 *
 * @author count
 */
public class PathWatchKey extends WatchKey {
	private int flags;
	private PathWatchService service;
	private Vector<WatchEvent<?>> eventQueue = new Vector<WatchEvent<?>>();