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

il.ac.bgu.cs.bp.bpjs.eventselection.EventSelectionStrategy Maven / Gradle / Ivy

package il.ac.bgu.cs.bp.bpjs.eventselection;

import il.ac.bgu.cs.bp.bpjs.bprogram.runtimeengine.BSyncStatement;
import il.ac.bgu.cs.bp.bpjs.events.BEvent;
import java.util.List;
import java.util.Optional;
import java.util.Set;

/**
 * Strategy for selecting events from a set of {@link BSyncStatement}s and an
 * external event queue.
 * 
 * This class has two methods, one for detecting the set of selectable events, 
 * and the other for selecting the actual event. The former is useful in both
 * execution and model checking. The latter - in execution only.
 * 
 * @author michael
 */
public interface EventSelectionStrategy {
    
    /**
     * Creates the set of selectable events, given the {@link BSyncStatement}s from 
     * all participating BThreads.
     * @param statements statements of all participating BThreads.
     * @param externalEvents events queued by external processes.
     * @return A set of events that may be selected for execution.
     */
    Set selectableEvents(Set statements, List externalEvents);
    
    /**
     * Selects an event for execution from the parameter {@code selectableEvents},
     * or returns {@link Optional#empty()} in case no suitable event is found.
     * 
     * @param statements statements of all participating BThreads.
     * @param externalEvents events queued by external processes.
     * @param selectableEvents A set of events to select from
     * @return An event selection result, or no result.
     */
    Optional select(Set statements, 
                                          List externalEvents,
                                          Set selectableEvents );
    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy