Search in sources :

Example 1 with WindowMessageImpl

use of edu.iu.dsc.tws.task.window.api.WindowMessageImpl in project twister2 by DSC-SPIDAL.

the class WindowManager method bundleNonExpiredWindowIMessage.

/**
 * This method bundles data into a IWindowMessage for creating non-expired IWindowMessages
 *
 * @param events list of elements that need to be passed into a window
 * @return a bundled IWindowMessage considering a list of IMessages of a given data type
 */
public IWindowMessage<T> bundleNonExpiredWindowIMessage(List<IMessage<T>> events) {
    WindowMessageImpl winMessage = null;
    List<IMessage<T>> messages = new ArrayList<>();
    for (IMessage<T> m : events) {
        messages.add(m);
    }
    winMessage = new WindowMessageImpl(messages);
    return winMessage;
}
Also used : WindowMessageImpl(edu.iu.dsc.tws.task.window.api.WindowMessageImpl) IMessage(edu.iu.dsc.tws.api.compute.IMessage) ArrayList(java.util.ArrayList)

Example 2 with WindowMessageImpl

use of edu.iu.dsc.tws.task.window.api.WindowMessageImpl in project twister2 by DSC-SPIDAL.

the class WindowManager method bundleWindowMessage.

public IWindowMessage<T> bundleWindowMessage(List<Event<T>> events) {
    WindowMessageImpl winMessage = null;
    List<IMessage<T>> messages = new ArrayList<>();
    for (Event<T> event : events) {
        IMessage<T> m = event.get();
        messages.add(m);
    }
    winMessage = new WindowMessageImpl(messages);
    return winMessage;
}
Also used : WindowMessageImpl(edu.iu.dsc.tws.task.window.api.WindowMessageImpl) IMessage(edu.iu.dsc.tws.api.compute.IMessage) ArrayList(java.util.ArrayList)

Example 3 with WindowMessageImpl

use of edu.iu.dsc.tws.task.window.api.WindowMessageImpl in project twister2 by DSC-SPIDAL.

the class WindowManager method bundleExpiredWindowIMessage.

/**
 * This method bundles data into a IWindowMessage for creating expired IWindowMessages
 *
 * @param events list of elements that need to be passed into a window
 * @return a bundled IWindowMessage considering a list of IMessages of a given data type
 */
public IWindowMessage<T> bundleExpiredWindowIMessage(List<IMessage<T>> events) {
    WindowMessageImpl winMessage = null;
    List<IMessage<T>> messages = new ArrayList<>();
    for (IMessage<T> m : events) {
        messages.add(m);
    }
    winMessage = new WindowMessageImpl(null, messages);
    return winMessage;
}
Also used : WindowMessageImpl(edu.iu.dsc.tws.task.window.api.WindowMessageImpl) IMessage(edu.iu.dsc.tws.api.compute.IMessage) ArrayList(java.util.ArrayList)

Aggregations

IMessage (edu.iu.dsc.tws.api.compute.IMessage)3 WindowMessageImpl (edu.iu.dsc.tws.task.window.api.WindowMessageImpl)3 ArrayList (java.util.ArrayList)3