All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.qt.core.QFuture Maven / Gradle / Ivy

There is a newer version: 6.8.1
Show newest version
package io.qt.core;

import io.qt.NativeAccess;
import io.qt.QNoImplementationException;

/**
 * 

Represents the result of an asynchronous computation

*

Java wrapper for Qt class QFuture

*/ public final class QFuture implements java.lang.Iterable, java.lang.Cloneable { static { QtJambi_LibraryUtilities.initialize(); } private final io.qt.core.QFutureInterfaceBase d; /** *

See QFuture::QFuture()

*/ public QFuture(){ d = QFutureInterface.canceledResult(); } /** *

See QFuture::QFuture(QFutureInterface<T>*)

*/ public QFuture(io.qt.core.QFutureInterface d){ super(); this.d = d.clone(); } @NativeAccess QFuture(io.qt.core.QFutureInterfaceBase d, boolean internal){ super(); java.util.Objects.requireNonNull(d, "Argument 'd': null not expected."); this.d = d; } /** *

See QFuture::cancel()

*/ @io.qt.QtUninvokable public final void cancel(){ d.cancel(); } /** *

See QFuture::isCanceled()const

*/ @io.qt.QtUninvokable public final boolean isCanceled(){ return d.isCanceled(); } /** *

See QFuture::isFinished()const

*/ @io.qt.QtUninvokable public final boolean isFinished(){ return d.isFinished(); } /** *

See QFuture::isPaused()const

* @deprecated Use isSuspending() or isSuspended() instead. */ @Deprecated @io.qt.QtUninvokable public final boolean isPaused(){ return d.isPaused(); } /** *

See QFuture::isSuspended()const

*/ @io.qt.QtUninvokable public final boolean isSuspended(){ return d.isSuspended(); } /** *

See QFuture::isSuspending()const

*/ @io.qt.QtUninvokable public final boolean isSuspending(){ return d.isSuspending(); } /** *

See QFuture::isResultReadyAt(int)const

*/ @io.qt.QtUninvokable public final boolean isResultReadyAt(int resultIndex){ return d.isResultReadyAt(resultIndex); } /** *

See QFuture::isRunning()const

*/ @io.qt.QtUninvokable public final boolean isRunning(){ return d.isRunning(); } /** *

See QFuture::isStarted()const

*/ @io.qt.QtUninvokable public final boolean isStarted(){ return d.isStarted(); } /** *

See QFuture::pause()

* @deprecated Use suspend() instead. */ @Deprecated @io.qt.QtUninvokable public final void pause(){ setPaused(true); } /** *

See QFuture::suspend()

*/ @io.qt.QtUninvokable public final void suspend(){ setSuspended(true); } /** *

See QFuture::progressMaximum()const

*/ @io.qt.QtUninvokable public final int progressMaximum(){ return d.progressMaximum(); } /** *

See QFuture::progressMinimum()const

*/ @io.qt.QtUninvokable public final int progressMinimum(){ return d.progressMinimum(); } /** *

See QFuture::progressText()const

*/ @io.qt.QtUninvokable public final java.lang.String progressText(){ return d.progressText(); } /** *

See QFuture::progressValue()const

*/ @io.qt.QtUninvokable public final int progressValue(){ return d.progressValue(); } /** *

See QFuture::result()const

*/ @io.qt.QtUninvokable public final T result(){ if(d instanceof QFutureInterface) { d.waitForResult(0); try{ return QFutureInterface.result(QtJambi_LibraryUtilities.internal.nativeId(d), 0); }catch(QNoImplementationException e) { throw new QNoImplementationException("result() not available for QFuture."); } }else { throw new QNoImplementationException("result() not available for QFuture."); } } /** *

See QFuture::resultAt(int)const

*/ @io.qt.QtUninvokable public final T resultAt(int index){ if(d instanceof QFutureInterface) { d.waitForResult(index); try{ return QFutureInterface.result(QtJambi_LibraryUtilities.internal.nativeId(d), index); }catch(QNoImplementationException e) { throw new QNoImplementationException("resultAt(int) not available for QFuture."); } }else { throw new QNoImplementationException("resultAt(int) not available for QFuture."); } } /** *

See QFuture::resultCount()const

*/ @io.qt.QtUninvokable public final int resultCount(){ return d.resultCount(); } /** *

See QFuture::results()const

*/ @io.qt.QtUninvokable public final io.qt.core.QList results(){ if(d instanceof QFutureInterface) { try{ return QFutureInterface.results(QtJambi_LibraryUtilities.internal.nativeId(d)); }catch(QNoImplementationException e) { throw new QNoImplementationException("results() not available for QFuture."); } }else { throw new QNoImplementationException("results() not available for QFuture."); } } /** *

See QFuture::resume()

*/ @io.qt.QtUninvokable public final void resume(){ setSuspended(false); } /** *

See QFuture::setPaused(bool)

* @deprecated Use setSuspended() instead. */ @Deprecated @io.qt.QtUninvokable public final void setPaused(boolean paused){ d.setPaused(paused); } /** *

See QFuture::setSuspended(bool)

*/ @io.qt.QtUninvokable public final void setSuspended(boolean suspended){ d.setSuspended(suspended); } /** *

See QFuture::togglePaused()

* @deprecated Use toggleSuspended() instead. */ @Deprecated @io.qt.QtUninvokable public final void togglePaused(){ d.togglePaused(); } /** *

See QFuture::toggleSuspended()

*/ @io.qt.QtUninvokable public final void toggleSuspended(){ d.toggleSuspended(); } /** *

See QFuture::waitForFinished()

*/ @io.qt.QtUninvokable public final void waitForFinished(){ d.waitForFinished(); } @Override public java.util.Iterator iterator() { if(d instanceof QFutureInterface) { if(d.isFinished()) return results().iterator(); return new java.util.Iterator(){ int i=0; @Override public boolean hasNext() { d.waitForResult(i); return d.isResultReadyAt(i); } @Override public T next() { return QFutureInterface.result(QtJambi_LibraryUtilities.internal.nativeId(d), i++); } }; }else { throw new QNoImplementationException("iterator() not available for QFutureInterfaceBase."); } } @Override @io.qt.QtUninvokable public boolean equals(Object other) { if (other instanceof io.qt.core.QFuture) { return d.equals(((io.qt.core.QFuture) other).d); } return false; } @io.qt.QtUninvokable @Override public int hashCode() { return d.hashCode(); } @Override public QFuture clone() { return new QFuture(d.clone(), true); } @io.qt.QtUninvokable public QFuture then(java.util.function.Function, R> function){ return then(QtJambi_LibraryUtilities.internal.nativeId(d), function); } @io.qt.QtUninvokable private native static QFuture then(long __this_nativeId, java.util.function.Function, R> function); @io.qt.QtUninvokable public QFuture then(QtFuture.Launch policy, java.util.function.Function, R> function){ return thenLaunch(QtJambi_LibraryUtilities.internal.nativeId(d), policy.value(), function); } @io.qt.QtUninvokable private native static QFuture thenLaunch(long __this_nativeId, int policy, java.util.function.Function, R> function); @io.qt.QtUninvokable public QFuture then(QThreadPool pool, java.util.function.Function, R> function){ return thenPool(QtJambi_LibraryUtilities.internal.nativeId(d), QtJambi_LibraryUtilities.internal.nativeId(pool), function); } @io.qt.QtUninvokable private native static QFuture thenPool(long __this_nativeId, long pool, java.util.function.Function, R> function); @io.qt.QtUninvokable public QFuture then(java.util.function.Consumer> function){ return thenVoid(QtJambi_LibraryUtilities.internal.nativeId(d), function); } @io.qt.QtUninvokable private native static QFuture thenVoid(long __this_nativeId, java.util.function.Consumer> function); @io.qt.QtUninvokable public QFuture then(QtFuture.Launch policy, java.util.function.Consumer> function){ return thenLaunchVoid(QtJambi_LibraryUtilities.internal.nativeId(d), policy.value(), function); } @io.qt.QtUninvokable private native static QFuture thenLaunchVoid(long __this_nativeId, int policy, java.util.function.Consumer> function); @io.qt.QtUninvokable public QFuture then(QThreadPool pool, java.util.function.Consumer> function){ return thenPoolVoid(QtJambi_LibraryUtilities.internal.nativeId(d), QtJambi_LibraryUtilities.internal.nativeId(pool), function); } @io.qt.QtUninvokable private native static QFuture thenPoolVoid(long __this_nativeId, long pool, java.util.function.Consumer> function); @io.qt.QtUninvokable public QFuture onFailed(java.util.function.Function function){ return onFailed(QtJambi_LibraryUtilities.internal.nativeId(d), function); } @io.qt.QtUninvokable public QFuture onCanceled(java.util.function.Supplier function){ return onCanceled(QtJambi_LibraryUtilities.internal.nativeId(d), function); } @io.qt.QtUninvokable public QFuture onFailed(java.util.function.Consumer function){ return onFailed(QtJambi_LibraryUtilities.internal.nativeId(d), function); } @io.qt.QtUninvokable private native static QFuture onFailed(long __this_nativeId, Object function); @io.qt.QtUninvokable public QFuture onCanceled(java.lang.Runnable function){ return onCanceled(QtJambi_LibraryUtilities.internal.nativeId(d), function); } @io.qt.QtUninvokable private native static QFuture onCanceled(long __this_nativeId, java.lang.Object function); @io.qt.QtUninvokable public QFuture then(QObject context, java.util.function.Function, R> function){ return thenPool(QtJambi_LibraryUtilities.internal.nativeId(d), QtJambi_LibraryUtilities.internal.checkedNativeId(java.util.Objects.requireNonNull(context)), function); } @io.qt.QtUninvokable private native static QFuture thenContext(long __this_nativeId, long contextId, java.util.function.Function, R> function); @io.qt.QtUninvokable public QFuture then(QObject context, java.util.function.Consumer> function){ return thenPoolVoid(QtJambi_LibraryUtilities.internal.nativeId(d), QtJambi_LibraryUtilities.internal.checkedNativeId(java.util.Objects.requireNonNull(context)), function); } @io.qt.QtUninvokable private native static QFuture thenContextVoid(long __this_nativeId, long contextId, java.util.function.Consumer> function); @io.qt.QtUninvokable public QFuture onFailed(QObject context, java.util.function.Function function){ return onFailedContext(QtJambi_LibraryUtilities.internal.nativeId(d), QtJambi_LibraryUtilities.internal.checkedNativeId(java.util.Objects.requireNonNull(context)), function); } @io.qt.QtUninvokable private native static QFuture onFailedContext(long __this_nativeId, long contextId, Object function); @io.qt.QtUninvokable public QFuture onCanceled(QObject context, java.util.function.Supplier function){ return onCanceledContext(QtJambi_LibraryUtilities.internal.nativeId(d), QtJambi_LibraryUtilities.internal.checkedNativeId(java.util.Objects.requireNonNull(context)), function); } @io.qt.QtUninvokable public QFuture onFailed(QObject context, java.util.function.Consumer function){ return onFailedContext(QtJambi_LibraryUtilities.internal.nativeId(d), QtJambi_LibraryUtilities.internal.checkedNativeId(java.util.Objects.requireNonNull(context)), function); } @io.qt.QtUninvokable public QFuture onCanceled(QObject context, java.lang.Runnable function){ return onCanceledContext(QtJambi_LibraryUtilities.internal.nativeId(d), QtJambi_LibraryUtilities.internal.checkedNativeId(java.util.Objects.requireNonNull(context)), function); } @io.qt.QtUninvokable private native static QFuture onCanceledContext(long __this_nativeId, long contextId, java.lang.Object function); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy