nl.tudelft.ewi.auta.srf.iface.Script Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of auta-srf Show documentation
Show all versions of auta-srf Show documentation
A facade for metric script executors
The newest version!
package nl.tudelft.ewi.auta.srf.iface;
import nl.tudelft.ewi.auta.srf.model.NoteCollection;
import javax.annotation.Nullable;
import java.util.Optional;
/**
* A script ready for execution in a context.
*
* @param the type of values the script accepts as parameters
*/
public interface Script extends AutoCloseable {
/**
* Executes a script once.
*
* @param data the results to run the script on
* @param templateData the template results to compare the results to, if any
* @param notes the collection of notes to be filled in by the script
*
* @return the score for grading, if any
*/
Optional execute(T data, @Nullable T templateData, NoteCollection notes);
/**
* Destroys the script.
*
* The script instance can no longer be executed. By default, this function does
* nothing and is purely symbolic. Implementations may require this function, however, so
* one should always close the script once it can be disposed of.
*
* This method should be called on all scripts before their associated instance is closed
* with {@link ScriptExecutionContext#close()}.
*/
@Override
default void close() throws Exception {
// Does nothing.
}
}