// Path: src/matlabcontrol/MatlabProxy.java
// public static interface Identifier {
// 	/**
// 	 * Returns {@code true} if {@code other} is equal to this identifier, {@code false} otherwise.
// 	 * 
// 	 * @param other
// 	 * @return 
// 	 */
// 	@Override
// 	public boolean equals(Object other);
// 
// 	/**
// 	 * Returns a hash code which conforms to the {@code hashCode} contract defined in {@link Object#hashCode()}.
// 	 * 
// 	 * @return 
// 	 */
// 	@Override
// 	public int hashCode();
// }
// 
// Path: src/matlabcontrol/MatlabProxyFactory.java
// public static interface Request {
// 	/**
// 	 * The identifier of the proxy associated with this request. If the proxy is created, then its identifier
// 	 * accessible via {@link MatlabProxy#getIdentifier()} will return {@code true} when tested for equivalence with
// 	 * the identifier returned by this method using {@link Identifier#equals(java.lang.Object)}.
// 	 * 
// 	 * @return proxy's identifier
// 	 */
// 	public Identifier getProxyIdentifer();
// 
// 	/**
// 	 * Attempts to cancel the request. If the request has already been completed or cannot successfully be canceled
// 	 * then {@code false} will be returned, otherwise {@code true} will be returned. If the request has already been
// 	 * successfully canceled then this method will have no effect and {@code true} will be returned.
// 	 * 
// 	 * @return if successfully cancelled
// 	 */
// 	public boolean cancel();
// 
// 	/**
// 	 * If the request has been successfully cancelled.
// 	 * 
// 	 * @return if successfully cancelled
// 	 */
// 	public boolean isCancelled();
// 
// 	/**
// 	 * Returns {@code true} if the proxy has been created.
// 	 * 
// 	 * @return if the proxy has been created
// 	 */
// 	public boolean isCompleted();
// }
// 
// Path: src/matlabcontrol/MatlabProxyFactory.java
// public static interface RequestCallback {
// 	/**
// 	 * Called when the proxy has been created. Because requests have no timeout, there is no guarantee that this
// 	 * method will ever be called.
// 	 * 
// 	 * @param proxy 
// 	 */
// 	public void proxyCreated(MatlabProxy proxy);
// }


import matlabcontrol.MatlabProxy.Identifier;
import matlabcontrol.MatlabProxyFactory.Request;
import matlabcontrol.MatlabProxyFactory.RequestCallback;
import java.util.concurrent.atomic.AtomicInteger;
/*
 * Code licensed under new-style BSD (see LICENSE).
 * All code up to tags/original: Copyright (c) 2013, Joshua Kaplan
 * All code after tags/original: Copyright (c) 2016, DiffPlug
 */
package matlabcontrol;



/**
 * Creates local instances of {@link MatlabProxy}.
 * 
 * @since 4.0.0
 * 
 * @author <a href="mailto:nonother@gmail.com">Joshua Kaplan</a>
 */
class LocalMatlabProxyFactory implements ProxyFactory {
	public LocalMatlabProxyFactory(MatlabProxyFactoryOptions options) {}

	@Override
	public LocalMatlabProxy getProxy() throws MatlabConnectionException {
		JMIValidator.validateJMIMethods();

		return new LocalMatlabProxy(new LocalIdentifier());
	}

	@Override
// Path: src/matlabcontrol/MatlabProxy.java
// public static interface Identifier {
// 	/**
// 	 * Returns {@code true} if {@code other} is equal to this identifier, {@code false} otherwise.
// 	 * 
// 	 * @param other
// 	 * @return 
// 	 */
// 	@Override
// 	public boolean equals(Object other);
// 
// 	/**
// 	 * Returns a hash code which conforms to the {@code hashCode} contract defined in {@link Object#hashCode()}.
// 	 * 
// 	 * @return 
// 	 */
// 	@Override
// 	public int hashCode();
// }
// 
// Path: src/matlabcontrol/MatlabProxyFactory.java
// public static interface Request {
// 	/**
// 	 * The identifier of the proxy associated with this request. If the proxy is created, then its identifier
// 	 * accessible via {@link MatlabProxy#getIdentifier()} will return {@code true} when tested for equivalence with
// 	 * the identifier returned by this method using {@link Identifier#equals(java.lang.Object)}.
// 	 * 
// 	 * @return proxy's identifier
// 	 */
// 	public Identifier getProxyIdentifer();
// 
// 	/**
// 	 * Attempts to cancel the request. If the request has already been completed or cannot successfully be canceled
// 	 * then {@code false} will be returned, otherwise {@code true} will be returned. If the request has already been
// 	 * successfully canceled then this method will have no effect and {@code true} will be returned.
// 	 * 
// 	 * @return if successfully cancelled
// 	 */
// 	public boolean cancel();
// 
// 	/**
// 	 * If the request has been successfully cancelled.
// 	 * 
// 	 * @return if successfully cancelled
// 	 */
// 	public boolean isCancelled();
// 
// 	/**
// 	 * Returns {@code true} if the proxy has been created.
// 	 * 
// 	 * @return if the proxy has been created
// 	 */
// 	public boolean isCompleted();
// }
// 
// Path: src/matlabcontrol/MatlabProxyFactory.java
// public static interface RequestCallback {
// 	/**
// 	 * Called when the proxy has been created. Because requests have no timeout, there is no guarantee that this
// 	 * method will ever be called.
// 	 * 
// 	 * @param proxy 
// 	 */
// 	public void proxyCreated(MatlabProxy proxy);
// }


// Path: src/matlabcontrol/LocalMatlabProxyFactory.java
import matlabcontrol.MatlabProxy.Identifier;
import matlabcontrol.MatlabProxyFactory.Request;
import matlabcontrol.MatlabProxyFactory.RequestCallback;
import java.util.concurrent.atomic.AtomicInteger;

/*
 * Code licensed under new-style BSD (see LICENSE).
 * All code up to tags/original: Copyright (c) 2013, Joshua Kaplan
 * All code after tags/original: Copyright (c) 2016, DiffPlug
 */
package matlabcontrol;



/**
 * Creates local instances of {@link MatlabProxy}.
 * 
 * @since 4.0.0
 * 
 * @author <a href="mailto:nonother@gmail.com">Joshua Kaplan</a>
 */
class LocalMatlabProxyFactory implements ProxyFactory {
	public LocalMatlabProxyFactory(MatlabProxyFactoryOptions options) {}

	@Override
	public LocalMatlabProxy getProxy() throws MatlabConnectionException {
		JMIValidator.validateJMIMethods();

		return new LocalMatlabProxy(new LocalIdentifier());
	}

	@Override
	public Request requestProxy(RequestCallback requestCallback) throws MatlabConnectionException {