org.pixel.pipeline.DataPipeline Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pixel-pipeline Show documentation
Show all versions of pixel-pipeline Show documentation
Modular Java/Kotlin 2D Game Framework.
/*
* This software is available under Apache License
* Copyright (c)
*/
package org.pixel.pipeline;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.concurrent.CompletableFuture;
public class DataPipeline {
private final LinkedList> handlerList;
/**
* Constructor.
*/
public DataPipeline() {
this.handlerList = new LinkedList<>();
}
/**
* Constructor.
*
* @param handlers The handlers to add to the pipeline.
*/
@SafeVarargs
public DataPipeline(PipelineHandler... handlers) {
this.handlerList = new LinkedList<>();
Collections.addAll(this.handlerList, handlers);
}
/**
* Begin processing the data.
*
* @param data The data to process.
*/
public CompletableFuture begin(T data) {
var future = new CompletableFuture();
new PipelineContext<>(this, future).next(data);
return future;
}
/**
* Get the handler list iterator.
*
* @return The handler list iterator.
*/
public Iterator> getHandlerIterator() {
return this.handlerList.iterator();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy