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

tools.plan.ServiceOperationsPlan Maven / Gradle / Ivy

package tools.plan;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;

import measure.LabeledOperation;
import tools.service.metadata.IOperationMetadata;

/**
 * Test plan
 */
public class ServiceOperationsPlan implements IServiceOperationsPlan {

	List setup = new ArrayList<>();

	List operations = new ArrayList<>();

	/**
	 * @param description of the operation
	 * @param operation   as a lambda
	 */
	public void setupCallable(IOperationMetadata description, Callable operation) {

		setup.add(new LabeledOperation(operations.size() + 1, description.description(), description.serializationKey(),
				operation, true));

	}

	/**
	 * @param description of the operation
	 * @param operation   as a lambda
	 */
	public void setupRunnable(IOperationMetadata description, Runnable operation) {

		setup.add(new LabeledOperation(operations.size() + 1, description.description(), description.serializationKey(),
				operation, true));

	}

	/**
	 * 
	 * @param description of the operation
	 * @param operation   as a lambda
	 */
	public void addCallable(IOperationMetadata description, Callable operation) {

		operations.add(new LabeledOperation(operations.size() + 1, description.description(),
				description.serializationKey(), operation, true));

	}

	/**
	 * 
	 * @param description of the operation
	 * @param operation   as a lambda
	 * @param record      true iff this measure has to be recored
	 */
	public void addC(IOperationMetadata description, Callable operation, boolean record) {

		operations.add(new LabeledOperation(operations.size() + 1, description.description(),
				description.serializationKey(), operation, record));

	}

	/**
	 * 
	 * @param description       of the operation
	 * @param serialization_key
	 * @param operation         as a lambda
	 */
	public void add(IOperationMetadata description, String serialization_key, Runnable operation) {

		operations.add(new LabeledOperation(operations.size() + 1, description.description(),
				description.serializationKey(), operation, true));

	}

	/**
	 * 
	 * @param description of the operation
	 * @param operation   as a lambda
	 */
	public void addRunnable(IOperationMetadata description, Runnable operation) {

		operations.add(new LabeledOperation(operations.size() + 1, description.description(),
				description.serializationKey(), operation, true));

	}

	/**
	 * 
	 * @param description of the operation
	 * @param operation   as a lambda
	 * @param record      true iff this measure has to be recored
	 */
	public void add(IOperationMetadata description, Runnable operation, boolean record) {

		operations.add(new LabeledOperation(operations.size() + 1, description.description(),
				description.serializationKey(), operation, record));

	}

	/**
	 * 
	 * @return the execution operation list
	 */
	public List getOperations() {
		return this.operations;
	}

	/**
	 * 
	 * @return the seutp operation list
	 */
	public List getSetupOperations() {
		return this.setup;
	}
	
	/**
	 * 
	 * @return the warmup operation list
	 */
	public List getWarmupOperations() {
		return this.setup;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy