Package matlabcontrol.extensions
Class CallbackMatlabProxy
- java.lang.Object
-
- matlabcontrol.extensions.CallbackMatlabProxy
-
public class CallbackMatlabProxy extends java.lang.ObjectDeprecated.This class was provided as a workaround whenMatlabProxycould not operate on the Event Dispatch Thread (EDT) used by AWT and Swing;MatlabProxyno longer has this limitation. Wraps around aMatlabProxymaking the method calls which interact with MATLAB operate with callbacks instead of return values. For each method inMatlabProxythat interacts with MATLAB, the same method exists but has one additional parameter that is eitherCallbackMatlabProxy.MatlabCallbackorCallbackMatlabProxy.MatlabDataCallback. Method invocations do not throwMatlabInvocationExceptions, but if the proxy throws aMatlabInvocationExceptionit will be provided to the callback.
All interactions with the proxy will be done in a single threaded manner. The underlying proxy methods will be completed in the order their corresponding methods in this class were called. Because method invocations on the proxy occur on a separate thread from the one calling the methods in this class, it can be used from within MATLAB on the Event Dispatch Thread (EDT).
This class is unconditionally thread-safe. There are no guarantees about the relative ordering of method completion when methods are invoked both on an instance of this class and on the proxy provided to it.- Since:
- 4.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceCallbackMatlabProxy.MatlabCallbackDeprecated.A callback that indicates either the invocation succeeding or an exception being raised.static interfaceCallbackMatlabProxy.MatlabDataCallback<V>Deprecated.A callback that supplies the results of the invocation or the raised exception.
-
Constructor Summary
Constructors Constructor Description CallbackMatlabProxy(MatlabProxy proxy)Deprecated.Constructs an instance of this class, delegating all method invocations to theproxy.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voiddisconnect(CallbackMatlabProxy.MatlabDataCallback<java.lang.Boolean> callback)Deprecated.Delegates to the proxy, calling thecallbackwhen the proxy's corresponding method has completed.voideval(CallbackMatlabProxy.MatlabCallback callback, java.lang.String command)Deprecated.Delegates to the proxy, calling thecallbackwhen the proxy's corresponding method has completed.voidexit(CallbackMatlabProxy.MatlabCallback callback)Deprecated.Delegates to the proxy, calling thecallbackwhen the proxy's corresponding method has completed.voidfeval(CallbackMatlabProxy.MatlabCallback callback, java.lang.String functionName, java.lang.Object... args)Deprecated.Delegates to the proxy, calling thecallbackwhen the proxy's corresponding method has completed.voidgetVariable(CallbackMatlabProxy.MatlabDataCallback<java.lang.Object> callback, java.lang.String variableName)Deprecated.Delegates to the proxy, calling thecallbackwhen the proxy's corresponding method has completed.<U> voidinvokeAndWait(MatlabProxy.MatlabThreadCallable<U> callable, CallbackMatlabProxy.MatlabDataCallback<U> callback)Deprecated.Delegates to the proxy, calling thecallbackwhen the method has been executed.voidisConnected(CallbackMatlabProxy.MatlabDataCallback<java.lang.Boolean> callback)Deprecated.Delegates to the proxy, calling thecallbackwhen the proxy's corresponding method has completed.voidreturningEval(CallbackMatlabProxy.MatlabDataCallback<java.lang.Object[]> callback, java.lang.String command, int nargout)Deprecated.Delegates to the proxy, calling thecallbackwhen the proxy's corresponding method has completed.voidreturningFeval(CallbackMatlabProxy.MatlabDataCallback<java.lang.Object[]> callback, java.lang.String functionName, int nargout, java.lang.Object... args)Deprecated.Delegates to the proxy, calling thecallbackwhen the proxy's corresponding method has completed.voidsetVariable(CallbackMatlabProxy.MatlabCallback callback, java.lang.String variableName, java.lang.Object value)Deprecated.Delegates to the proxy, calling thecallbackwhen the proxy's corresponding method has completed.java.lang.StringtoString()Deprecated.Returns a brief description.
-
-
-
Constructor Detail
-
CallbackMatlabProxy
public CallbackMatlabProxy(MatlabProxy proxy)
Deprecated.Constructs an instance of this class, delegating all method invocations to theproxy.- Parameters:
proxy-
-
-
Method Detail
-
toString
public java.lang.String toString()
Deprecated.Returns a brief description. The exact details of this representation are unspecified and are subject to change.- Overrides:
toStringin classjava.lang.Object- Returns:
-
isConnected
public void isConnected(CallbackMatlabProxy.MatlabDataCallback<java.lang.Boolean> callback)
Deprecated.Delegates to the proxy, calling thecallbackwhen the proxy's corresponding method has completed.
-
disconnect
public void disconnect(CallbackMatlabProxy.MatlabDataCallback<java.lang.Boolean> callback)
Deprecated.Delegates to the proxy, calling thecallbackwhen the proxy's corresponding method has completed.- Parameters:
callback-
-
exit
public void exit(CallbackMatlabProxy.MatlabCallback callback)
Deprecated.Delegates to the proxy, calling thecallbackwhen the proxy's corresponding method has completed.- Parameters:
callback-
-
eval
public void eval(CallbackMatlabProxy.MatlabCallback callback, java.lang.String command)
Deprecated.Delegates to the proxy, calling thecallbackwhen the proxy's corresponding method has completed.- Parameters:
callback-command-
-
returningEval
public void returningEval(CallbackMatlabProxy.MatlabDataCallback<java.lang.Object[]> callback, java.lang.String command, int nargout)
Deprecated.Delegates to the proxy, calling thecallbackwhen the proxy's corresponding method has completed.- Parameters:
callback-command-nargout-
-
feval
public void feval(CallbackMatlabProxy.MatlabCallback callback, java.lang.String functionName, java.lang.Object... args)
Deprecated.Delegates to the proxy, calling thecallbackwhen the proxy's corresponding method has completed.- Parameters:
callback-functionName-args-
-
returningFeval
public void returningFeval(CallbackMatlabProxy.MatlabDataCallback<java.lang.Object[]> callback, java.lang.String functionName, int nargout, java.lang.Object... args)
Deprecated.Delegates to the proxy, calling thecallbackwhen the proxy's corresponding method has completed.- Parameters:
callback-functionName-nargout-args-
-
setVariable
public void setVariable(CallbackMatlabProxy.MatlabCallback callback, java.lang.String variableName, java.lang.Object value)
Deprecated.Delegates to the proxy, calling thecallbackwhen the proxy's corresponding method has completed.- Parameters:
callback-variableName-value-
-
getVariable
public void getVariable(CallbackMatlabProxy.MatlabDataCallback<java.lang.Object> callback, java.lang.String variableName)
Deprecated.Delegates to the proxy, calling thecallbackwhen the proxy's corresponding method has completed.- Parameters:
callback-variableName-
-
invokeAndWait
public <U> void invokeAndWait(MatlabProxy.MatlabThreadCallable<U> callable, CallbackMatlabProxy.MatlabDataCallback<U> callback)
Deprecated.Delegates to the proxy, calling thecallbackwhen the method has been executed.
The name of this method has been retained for consistency withMatlabProxy, but note that while the code in thecallablewill be invoked on the MATLAB thread and it will wait until completion so as to return a result, this method - like all others in this class, will not wait for completion. Instead, the result will be provided to thecallback.- Parameters:
callable-callback-
-
-