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

org.scijava.ops.engine.adapt.functional.ComputersToFunctionsViaSource Maven / Gradle / Ivy

The newest version!
/*-
 * #%L
 * Java implementation of the SciJava Ops matching engine.
 * %%
 * Copyright (C) 2016 - 2024 SciJava developers.
 * %%
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * 
 * 1. Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 * #L%
 */
/*
 * This is autogenerated source code -- DO NOT EDIT. Instead, edit the
 * corresponding template in templates/ and rerun bin/generate.groovy.
 */

package org.scijava.ops.engine.adapt.functional;

import java.util.function.BiFunction;
import java.util.function.Function;

import org.scijava.function.Computers;
import org.scijava.function.Functions;
import org.scijava.function.Producer;
import org.scijava.ops.engine.BaseOpHints.Adaptation;
import org.scijava.ops.spi.OpDependency;
import org.scijava.ops.spi.Op;
import org.scijava.ops.spi.OpClass;
import org.scijava.priority.Priority;

/**
 * Collection of adaptation Ops to convert {@link Computers} into
 * {@link Functions} with the use of a {@link Producer} that creates the output
 * using the first input as a model.
 * 
 * @author Gabriel Selzer
 */
public class ComputersToFunctionsViaSource {

	@OpClass(names = "engine.adapt", priority = Priority.LOW)
	public static class Computer0ToFunction0ViaSource
			implements Function, Producer>, 
			Op
		{

		@OpDependency(name = "engine.create", hints={Adaptation.FORBIDDEN})
		Producer creator;

		/**
		 * @param computer the computer to adapt
		 * @return a Function adaptation of computer
		 */
		@Override
		public Producer apply(Computers.Arity0 computer) {
			return () -> {
				O out = creator.create();
				computer.compute(out);
				return out;
			};
		}

	}

	@OpClass(names = "engine.adapt", priority = Priority.LOW)
	public static class Computer1ToFunction1ViaSource
			implements Function, Function>, 
			Op
		{

		@OpDependency(name = "engine.create", hints={Adaptation.FORBIDDEN})
		Producer creator;

		/**
		 * @param computer the computer to adapt
		 * @return a Function adaptation of computer
		 */
		@Override
		public Function apply(Computers.Arity1 computer) {
			return (in) -> {
				O out = creator.create();
				computer.compute(in, out);
				return out;
			};
		}

	}

	@OpClass(names = "engine.adapt", priority = Priority.LOW)
	public static class Computer2ToFunction2ViaSource
			implements Function, BiFunction>, 
			Op
		{

		@OpDependency(name = "engine.create", hints={Adaptation.FORBIDDEN})
		Producer creator;

		/**
		 * @param computer the computer to adapt
		 * @return a Function adaptation of computer
		 */
		@Override
		public BiFunction apply(Computers.Arity2 computer) {
			return (in1, in2) -> {
				O out = creator.create();
				computer.compute(in1, in2, out);
				return out;
			};
		}

	}

	@OpClass(names = "engine.adapt", priority = Priority.LOW)
	public static class Computer3ToFunction3ViaSource
			implements Function, Functions.Arity3>, 
			Op
		{

		@OpDependency(name = "engine.create", hints={Adaptation.FORBIDDEN})
		Producer creator;

		/**
		 * @param computer the computer to adapt
		 * @return a Function adaptation of computer
		 */
		@Override
		public Functions.Arity3 apply(Computers.Arity3 computer) {
			return (in1, in2, in3) -> {
				O out = creator.create();
				computer.compute(in1, in2, in3, out);
				return out;
			};
		}

	}

	@OpClass(names = "engine.adapt", priority = Priority.LOW)
	public static class Computer4ToFunction4ViaSource
			implements Function, Functions.Arity4>, 
			Op
		{

		@OpDependency(name = "engine.create", hints={Adaptation.FORBIDDEN})
		Producer creator;

		/**
		 * @param computer the computer to adapt
		 * @return a Function adaptation of computer
		 */
		@Override
		public Functions.Arity4 apply(Computers.Arity4 computer) {
			return (in1, in2, in3, in4) -> {
				O out = creator.create();
				computer.compute(in1, in2, in3, in4, out);
				return out;
			};
		}

	}

	@OpClass(names = "engine.adapt", priority = Priority.LOW)
	public static class Computer5ToFunction5ViaSource
			implements Function, Functions.Arity5>, 
			Op
		{

		@OpDependency(name = "engine.create", hints={Adaptation.FORBIDDEN})
		Producer creator;

		/**
		 * @param computer the computer to adapt
		 * @return a Function adaptation of computer
		 */
		@Override
		public Functions.Arity5 apply(Computers.Arity5 computer) {
			return (in1, in2, in3, in4, in5) -> {
				O out = creator.create();
				computer.compute(in1, in2, in3, in4, in5, out);
				return out;
			};
		}

	}

	@OpClass(names = "engine.adapt", priority = Priority.LOW)
	public static class Computer6ToFunction6ViaSource
			implements Function, Functions.Arity6>, 
			Op
		{

		@OpDependency(name = "engine.create", hints={Adaptation.FORBIDDEN})
		Producer creator;

		/**
		 * @param computer the computer to adapt
		 * @return a Function adaptation of computer
		 */
		@Override
		public Functions.Arity6 apply(Computers.Arity6 computer) {
			return (in1, in2, in3, in4, in5, in6) -> {
				O out = creator.create();
				computer.compute(in1, in2, in3, in4, in5, in6, out);
				return out;
			};
		}

	}

	@OpClass(names = "engine.adapt", priority = Priority.LOW)
	public static class Computer7ToFunction7ViaSource
			implements Function, Functions.Arity7>, 
			Op
		{

		@OpDependency(name = "engine.create", hints={Adaptation.FORBIDDEN})
		Producer creator;

		/**
		 * @param computer the computer to adapt
		 * @return a Function adaptation of computer
		 */
		@Override
		public Functions.Arity7 apply(Computers.Arity7 computer) {
			return (in1, in2, in3, in4, in5, in6, in7) -> {
				O out = creator.create();
				computer.compute(in1, in2, in3, in4, in5, in6, in7, out);
				return out;
			};
		}

	}

	@OpClass(names = "engine.adapt", priority = Priority.LOW)
	public static class Computer8ToFunction8ViaSource
			implements Function, Functions.Arity8>, 
			Op
		{

		@OpDependency(name = "engine.create", hints={Adaptation.FORBIDDEN})
		Producer creator;

		/**
		 * @param computer the computer to adapt
		 * @return a Function adaptation of computer
		 */
		@Override
		public Functions.Arity8 apply(Computers.Arity8 computer) {
			return (in1, in2, in3, in4, in5, in6, in7, in8) -> {
				O out = creator.create();
				computer.compute(in1, in2, in3, in4, in5, in6, in7, in8, out);
				return out;
			};
		}

	}

	@OpClass(names = "engine.adapt", priority = Priority.LOW)
	public static class Computer9ToFunction9ViaSource
			implements Function, Functions.Arity9>, 
			Op
		{

		@OpDependency(name = "engine.create", hints={Adaptation.FORBIDDEN})
		Producer creator;

		/**
		 * @param computer the computer to adapt
		 * @return a Function adaptation of computer
		 */
		@Override
		public Functions.Arity9 apply(Computers.Arity9 computer) {
			return (in1, in2, in3, in4, in5, in6, in7, in8, in9) -> {
				O out = creator.create();
				computer.compute(in1, in2, in3, in4, in5, in6, in7, in8, in9, out);
				return out;
			};
		}

	}

	@OpClass(names = "engine.adapt", priority = Priority.LOW)
	public static class Computer10ToFunction10ViaSource
			implements Function, Functions.Arity10>, 
			Op
		{

		@OpDependency(name = "engine.create", hints={Adaptation.FORBIDDEN})
		Producer creator;

		/**
		 * @param computer the computer to adapt
		 * @return a Function adaptation of computer
		 */
		@Override
		public Functions.Arity10 apply(Computers.Arity10 computer) {
			return (in1, in2, in3, in4, in5, in6, in7, in8, in9, in10) -> {
				O out = creator.create();
				computer.compute(in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, out);
				return out;
			};
		}

	}

	@OpClass(names = "engine.adapt", priority = Priority.LOW)
	public static class Computer11ToFunction11ViaSource
			implements Function, Functions.Arity11>, 
			Op
		{

		@OpDependency(name = "engine.create", hints={Adaptation.FORBIDDEN})
		Producer creator;

		/**
		 * @param computer the computer to adapt
		 * @return a Function adaptation of computer
		 */
		@Override
		public Functions.Arity11 apply(Computers.Arity11 computer) {
			return (in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11) -> {
				O out = creator.create();
				computer.compute(in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, out);
				return out;
			};
		}

	}

	@OpClass(names = "engine.adapt", priority = Priority.LOW)
	public static class Computer12ToFunction12ViaSource
			implements Function, Functions.Arity12>, 
			Op
		{

		@OpDependency(name = "engine.create", hints={Adaptation.FORBIDDEN})
		Producer creator;

		/**
		 * @param computer the computer to adapt
		 * @return a Function adaptation of computer
		 */
		@Override
		public Functions.Arity12 apply(Computers.Arity12 computer) {
			return (in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12) -> {
				O out = creator.create();
				computer.compute(in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, out);
				return out;
			};
		}

	}

	@OpClass(names = "engine.adapt", priority = Priority.LOW)
	public static class Computer13ToFunction13ViaSource
			implements Function, Functions.Arity13>, 
			Op
		{

		@OpDependency(name = "engine.create", hints={Adaptation.FORBIDDEN})
		Producer creator;

		/**
		 * @param computer the computer to adapt
		 * @return a Function adaptation of computer
		 */
		@Override
		public Functions.Arity13 apply(Computers.Arity13 computer) {
			return (in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13) -> {
				O out = creator.create();
				computer.compute(in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, out);
				return out;
			};
		}

	}

	@OpClass(names = "engine.adapt", priority = Priority.LOW)
	public static class Computer14ToFunction14ViaSource
			implements Function, Functions.Arity14>, 
			Op
		{

		@OpDependency(name = "engine.create", hints={Adaptation.FORBIDDEN})
		Producer creator;

		/**
		 * @param computer the computer to adapt
		 * @return a Function adaptation of computer
		 */
		@Override
		public Functions.Arity14 apply(Computers.Arity14 computer) {
			return (in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14) -> {
				O out = creator.create();
				computer.compute(in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, out);
				return out;
			};
		}

	}

	@OpClass(names = "engine.adapt", priority = Priority.LOW)
	public static class Computer15ToFunction15ViaSource
			implements Function, Functions.Arity15>, 
			Op
		{

		@OpDependency(name = "engine.create", hints={Adaptation.FORBIDDEN})
		Producer creator;

		/**
		 * @param computer the computer to adapt
		 * @return a Function adaptation of computer
		 */
		@Override
		public Functions.Arity15 apply(Computers.Arity15 computer) {
			return (in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15) -> {
				O out = creator.create();
				computer.compute(in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, out);
				return out;
			};
		}

	}

	@OpClass(names = "engine.adapt", priority = Priority.LOW)
	public static class Computer16ToFunction16ViaSource
			implements Function, Functions.Arity16>, 
			Op
		{

		@OpDependency(name = "engine.create", hints={Adaptation.FORBIDDEN})
		Producer creator;

		/**
		 * @param computer the computer to adapt
		 * @return a Function adaptation of computer
		 */
		@Override
		public Functions.Arity16 apply(Computers.Arity16 computer) {
			return (in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16) -> {
				O out = creator.create();
				computer.compute(in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, in15, in16, out);
				return out;
			};
		}

	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy