Server/Server/src/main/java/uulm/teamname/marvelous/server/game/pipelining/Segment.java

26 lines
1.4 KiB
Java

package uulm.teamname.marvelous.server.game.pipelining;
import uulm.teamname.marvelous.gamelibrary.events.Event;
import uulm.teamname.marvelous.gamelibrary.requests.Request;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
public interface Segment {
/**
* Pipelining method to process a set of requests. The list of requests will be processed according to some set of
* rules. Hereby, the {@link Request Requests} in the packet will be filtered out as appropriate, whereby the
* resulting {@link Event Events} are appended to the carrier.
*
* @param packet is a {@link List} of {@link Request Requests} that is filtered by the {@link Segment} as
* appropriate
* @param carrier is a {@link List} of {@link Event Events} that is appended to if new requests are generated from
* the execution of the {@link Segment}
* @param abort is an {@link AtomicBoolean} describing whether an error has occurred during the execution of the
* {@link Segment} Note that <b>error</b> here does <b>not describe an execution error</b> of the
* segment, but instead an error in the events passed to it, like for example moving into a Rock. The
* conventional way of setting this boolean is to write {@code abort.set(true); return;}
*/
void processRequests(Packet packet, List<Event> carrier, AtomicBoolean abort);
}