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

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

package io.qt.core;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;

import io.qt.NonNull;

/**
 * 

Convenience class that simplifies QFuture synchronization

*

Java wrapper for Qt class QFutureSynchronizer

*/ public final class QFutureSynchronizer { static { QtJambi_LibraryUtilities.initialize(); } /** *

See QFutureSynchronizer::QFutureSynchronizer()

*/ public QFutureSynchronizer(){ super(); } /** *

See QFutureSynchronizer::QFutureSynchronizer(QFuture<T>)

*/ public QFutureSynchronizer(@NonNull QFuture future){ super(); addFuture(future); } /** *

See QFutureSynchronizer::addFuture(QFuture<T>)

*/ @io.qt.QtUninvokable public final void addFuture(@NonNull QFuture future){ m_futures.add(Objects.requireNonNull(future, "Argument 'future': null not expected.")); } /** *

See QFutureSynchronizer::cancelOnWait()const

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

See QFutureSynchronizer::clearFutures()

*/ @io.qt.QtUninvokable public final void clearFutures(){ m_futures.clear(); } /** *

See QFutureSynchronizer::setCancelOnWait(bool)

*/ @io.qt.QtUninvokable public final void setCancelOnWait(boolean enabled){ this.m_cancelOnWait = enabled; } /** *

See QFutureSynchronizer::setFuture(QFuture<T>)

*/ @io.qt.QtUninvokable public final void setFuture(@NonNull QFuture future){ waitForFinished(); m_futures.clear(); addFuture(future); } /** *

See QFutureSynchronizer::waitForFinished()const

*/ @io.qt.QtUninvokable public final void waitForFinished(){ if (m_cancelOnWait) { for (int i = 0; i < m_futures.size(); ++i) { m_futures.get(i).cancel(); } } for (int i = 0; i < m_futures.size(); ++i) { m_futures.get(i).waitForFinished(); } } /** *

See QFutureSynchronizer::futures()const

*/ @io.qt.QtUninvokable public final @NonNull List<@NonNull QFuture> futures() { return Collections.unmodifiableList(m_futures); } private final List> m_futures = new ArrayList<>(); private boolean m_cancelOnWait; }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy