Class Tuple2Future<E,​F>

    • Constructor Detail

      • Tuple2Future

        public Tuple2Future()
        Create a future that is already done.
        Parameters:
        result - The result, if any.
      • Tuple2Future

        public Tuple2Future​(E result1,
                            F result2)
        Create a future that is already done.
        Parameters:
        result - The result, if any.
      • Tuple2Future

        public Tuple2Future​(java.lang.Exception exception)
        Create a future that is already done (failed).
        Parameters:
        exception - The exception.
    • Method Detail

      • getFirstResult

        public E getFirstResult​(ThreadSuspendable sus)
        Deprecated.
        - From 3.0. Use method without suspendable. Will NOT use the suspendable that is supplied as parameter. Get the first result.
        Specified by:
        getFirstResult in interface ITuple2Future<E,​F>
        Returns:
        The next intermediate result.
      • getFirstResult

        public E getFirstResult()
        Get the first result.
        Specified by:
        getFirstResult in interface ITuple2Future<E,​F>
        Returns:
        The next intermediate result.
      • getSecondResult

        public F getSecondResult()
        Get the second result.
        Specified by:
        getSecondResult in interface ITuple2Future<E,​F>
        Returns:
        The next intermediate result.
      • getFirstResult

        public E getFirstResult​(long timeout)
        Get the first result.
        Specified by:
        getFirstResult in interface ITuple2Future<E,​F>
        Parameters:
        timeout - The timeout in millis.
        Returns:
        The next intermediate result.
      • getSecondResult

        public F getSecondResult​(long timeout)
        Get the second result.
        Specified by:
        getSecondResult in interface ITuple2Future<E,​F>
        Parameters:
        timeout - The timeout in millis.
        Returns:
        The next intermediate result.
      • getFirstResult

        public E getFirstResult​(long timeout,
                                boolean realtime)
        Get the first result.
        Specified by:
        getFirstResult in interface ITuple2Future<E,​F>
        Parameters:
        timeout - The timeout in millis.
        realtime - Flag if wait should be realtime (in contrast to simulation time).
        Returns:
        The next intermediate result.
      • getSecondResult

        public F getSecondResult​(long timeout,
                                 boolean realtime)
        Get the second result.
        Specified by:
        getSecondResult in interface ITuple2Future<E,​F>
        Parameters:
        timeout - The timeout in millis.
        realtime - Flag if wait should be realtime (in contrast to simulation time).
        Returns:
        The next intermediate result.
      • setFirstResult

        public void setFirstResult​(E result)
        Set the result. Listener notifications occur on calling thread of this method.
        Parameters:
        result - The result.
      • setSecondResult

        public void setSecondResult​(F result)
        Set the result. Listener notifications occur on calling thread of this method.
        Parameters:
        result - The result.
      • setFirstResultIfUndone

        public void setFirstResultIfUndone​(E result)
        Set the result. Listener notifications occur on calling thread of this method.
        Parameters:
        result - The result.
      • addTuple2ResultListener

        public void addTuple2ResultListener​(IFunctionalResultListener<E> firstListener,
                                            IFunctionalResultListener<F> secondListener)
        Uses two functional result listeners to create a Tuple2ResultListener and add it. The first listener is called upon reception of the first result, the second is called for the second result. Exceptions will be logged to console.
        Specified by:
        addTuple2ResultListener in interface ITuple2Future<E,​F>
        Parameters:
        firstListener - Listener for the first available result.
        secondListener - Listener for the second available result.
      • addTuple2ResultListener

        public void addTuple2ResultListener​(IFunctionalResultListener<E> firstListener,
                                            IFunctionalResultListener<F> secondListener,
                                            IFunctionalExceptionListener exceptionListener)
        Uses two functional result listeners to create a Tuple2ResultListener and add it. The first listener is called upon reception of the first result, the second is called for the second result. Additionally, a given exception listener is called when exceptions occur.
        Specified by:
        addTuple2ResultListener in interface ITuple2Future<E,​F>
        Parameters:
        firstListener - Listener for the first available result.
        secondListener - Listener for the second available result.
        exListener - The listener that is called on exceptions. Passing null enables default exception logging.
      • setSecondResultIfUndone

        public void setSecondResultIfUndone​(F result)
        Set the result. Listener notifications occur on calling thread of this method.
        Parameters:
        result - The result.
      • setXResult

        protected void setXResult​(int idx,
                                  java.lang.Object res)
        Set the xth result.
      • setXResultIfUndone

        protected void setXResultIfUndone​(int idx,
                                          java.lang.Object res)
        Set the xth result.
      • getXResult

        protected java.lang.Object getXResult​(int idx,
                                              long timeout,
                                              boolean realtime)
        Get the x result.
        Returns:
        The next intermediate result.
      • findResult

        protected TupleResult findResult​(int idx)
        Find result in results
      • getMax

        protected int getMax()
        Get the number of results of the type of future..