org.scijava.ops.engine.adapt.lift.ComputerToIterables Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scijava-ops-engine Show documentation
Show all versions of scijava-ops-engine Show documentation
Java implementation of the SciJava Ops matching engine.
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.lift;
import java.util.Iterator;
import java.util.function.Function;
import org.scijava.function.Computers;
import org.scijava.ops.spi.OpField;
import org.scijava.ops.spi.OpCollection;
/**
* Converts {@link Computers} operating on single types to {@link Computers}
* that operate on {@link Iterable}s of types. N.B. it is the user's
* responsibility to pass {@link Iterable}s of the same length (otherwise the Op
* will stop when one of the {@link Iterable}s runs out of {@link Object}s).
*
* @author Gabriel Selzer
*/
public class ComputerToIterables implements OpCollection {
@OpField(names = "engine.adapt")
public final Function, Computers.Arity0>> liftComputer0 =
(computer) -> {
return (out) -> {
Iterator itrout = out.iterator();
while (itrout.hasNext()) {
computer.compute(itrout.next());
}
};
};
@OpField(names = "engine.adapt")
public final Function, Computers.Arity1, Iterable>> liftComputer1 =
(computer) -> {
return (in, out) -> {
Iterator itrin = in.iterator();
Iterator itrout = out.iterator();
while (itrin.hasNext() && itrout.hasNext()) {
computer.compute(itrin.next(), itrout.next());
}
};
};
@OpField(names = "engine.adapt")
public final Function, Computers.Arity2, Iterable, Iterable>> liftComputer2 =
(computer) -> {
return (in1, in2, out) -> {
Iterator itrin1 = in1.iterator();
Iterator itrin2 = in2.iterator();
Iterator itrout = out.iterator();
while (itrin1.hasNext() && itrin2.hasNext() && itrout.hasNext()) {
computer.compute(itrin1.next(), itrin2.next(), itrout.next());
}
};
};
@OpField(names = "engine.adapt")
public final Function, Computers.Arity3, Iterable, Iterable, Iterable>> liftComputer3 =
(computer) -> {
return (in1, in2, in3, out) -> {
Iterator itrin1 = in1.iterator();
Iterator itrin2 = in2.iterator();
Iterator itrin3 = in3.iterator();
Iterator itrout = out.iterator();
while (itrin1.hasNext() && itrin2.hasNext() && itrin3.hasNext() && itrout.hasNext()) {
computer.compute(itrin1.next(), itrin2.next(), itrin3.next(), itrout.next());
}
};
};
@OpField(names = "engine.adapt")
public final Function, Computers.Arity4, Iterable, Iterable, Iterable, Iterable>> liftComputer4 =
(computer) -> {
return (in1, in2, in3, in4, out) -> {
Iterator itrin1 = in1.iterator();
Iterator itrin2 = in2.iterator();
Iterator itrin3 = in3.iterator();
Iterator itrin4 = in4.iterator();
Iterator itrout = out.iterator();
while (itrin1.hasNext() && itrin2.hasNext() && itrin3.hasNext() && itrin4.hasNext() && itrout.hasNext()) {
computer.compute(itrin1.next(), itrin2.next(), itrin3.next(), itrin4.next(), itrout.next());
}
};
};
@OpField(names = "engine.adapt")
public final Function, Computers.Arity5, Iterable, Iterable, Iterable, Iterable, Iterable>> liftComputer5 =
(computer) -> {
return (in1, in2, in3, in4, in5, out) -> {
Iterator itrin1 = in1.iterator();
Iterator itrin2 = in2.iterator();
Iterator itrin3 = in3.iterator();
Iterator itrin4 = in4.iterator();
Iterator itrin5 = in5.iterator();
Iterator itrout = out.iterator();
while (itrin1.hasNext() && itrin2.hasNext() && itrin3.hasNext() && itrin4.hasNext() && itrin5.hasNext() && itrout.hasNext()) {
computer.compute(itrin1.next(), itrin2.next(), itrin3.next(), itrin4.next(), itrin5.next(), itrout.next());
}
};
};
@OpField(names = "engine.adapt")
public final Function, Computers.Arity6, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable>> liftComputer6 =
(computer) -> {
return (in1, in2, in3, in4, in5, in6, out) -> {
Iterator itrin1 = in1.iterator();
Iterator itrin2 = in2.iterator();
Iterator itrin3 = in3.iterator();
Iterator itrin4 = in4.iterator();
Iterator itrin5 = in5.iterator();
Iterator itrin6 = in6.iterator();
Iterator itrout = out.iterator();
while (itrin1.hasNext() && itrin2.hasNext() && itrin3.hasNext() && itrin4.hasNext() && itrin5.hasNext() && itrin6.hasNext() && itrout.hasNext()) {
computer.compute(itrin1.next(), itrin2.next(), itrin3.next(), itrin4.next(), itrin5.next(), itrin6.next(), itrout.next());
}
};
};
@OpField(names = "engine.adapt")
public final Function, Computers.Arity7, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable>> liftComputer7 =
(computer) -> {
return (in1, in2, in3, in4, in5, in6, in7, out) -> {
Iterator itrin1 = in1.iterator();
Iterator itrin2 = in2.iterator();
Iterator itrin3 = in3.iterator();
Iterator itrin4 = in4.iterator();
Iterator itrin5 = in5.iterator();
Iterator itrin6 = in6.iterator();
Iterator itrin7 = in7.iterator();
Iterator itrout = out.iterator();
while (itrin1.hasNext() && itrin2.hasNext() && itrin3.hasNext() && itrin4.hasNext() && itrin5.hasNext() && itrin6.hasNext() && itrin7.hasNext() && itrout.hasNext()) {
computer.compute(itrin1.next(), itrin2.next(), itrin3.next(), itrin4.next(), itrin5.next(), itrin6.next(), itrin7.next(), itrout.next());
}
};
};
@OpField(names = "engine.adapt")
public final Function, Computers.Arity8, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable>> liftComputer8 =
(computer) -> {
return (in1, in2, in3, in4, in5, in6, in7, in8, out) -> {
Iterator itrin1 = in1.iterator();
Iterator itrin2 = in2.iterator();
Iterator itrin3 = in3.iterator();
Iterator itrin4 = in4.iterator();
Iterator itrin5 = in5.iterator();
Iterator itrin6 = in6.iterator();
Iterator itrin7 = in7.iterator();
Iterator itrin8 = in8.iterator();
Iterator itrout = out.iterator();
while (itrin1.hasNext() && itrin2.hasNext() && itrin3.hasNext() && itrin4.hasNext() && itrin5.hasNext() && itrin6.hasNext() && itrin7.hasNext() && itrin8.hasNext() && itrout.hasNext()) {
computer.compute(itrin1.next(), itrin2.next(), itrin3.next(), itrin4.next(), itrin5.next(), itrin6.next(), itrin7.next(), itrin8.next(), itrout.next());
}
};
};
@OpField(names = "engine.adapt")
public final Function, Computers.Arity9, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable>> liftComputer9 =
(computer) -> {
return (in1, in2, in3, in4, in5, in6, in7, in8, in9, out) -> {
Iterator itrin1 = in1.iterator();
Iterator itrin2 = in2.iterator();
Iterator itrin3 = in3.iterator();
Iterator itrin4 = in4.iterator();
Iterator itrin5 = in5.iterator();
Iterator itrin6 = in6.iterator();
Iterator itrin7 = in7.iterator();
Iterator itrin8 = in8.iterator();
Iterator itrin9 = in9.iterator();
Iterator itrout = out.iterator();
while (itrin1.hasNext() && itrin2.hasNext() && itrin3.hasNext() && itrin4.hasNext() && itrin5.hasNext() && itrin6.hasNext() && itrin7.hasNext() && itrin8.hasNext() && itrin9.hasNext() && itrout.hasNext()) {
computer.compute(itrin1.next(), itrin2.next(), itrin3.next(), itrin4.next(), itrin5.next(), itrin6.next(), itrin7.next(), itrin8.next(), itrin9.next(), itrout.next());
}
};
};
@OpField(names = "engine.adapt")
public final Function, Computers.Arity10, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable>> liftComputer10 =
(computer) -> {
return (in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, out) -> {
Iterator itrin1 = in1.iterator();
Iterator itrin2 = in2.iterator();
Iterator itrin3 = in3.iterator();
Iterator itrin4 = in4.iterator();
Iterator itrin5 = in5.iterator();
Iterator itrin6 = in6.iterator();
Iterator itrin7 = in7.iterator();
Iterator itrin8 = in8.iterator();
Iterator itrin9 = in9.iterator();
Iterator itrin10 = in10.iterator();
Iterator itrout = out.iterator();
while (itrin1.hasNext() && itrin2.hasNext() && itrin3.hasNext() && itrin4.hasNext() && itrin5.hasNext() && itrin6.hasNext() && itrin7.hasNext() && itrin8.hasNext() && itrin9.hasNext() && itrin10.hasNext() && itrout.hasNext()) {
computer.compute(itrin1.next(), itrin2.next(), itrin3.next(), itrin4.next(), itrin5.next(), itrin6.next(), itrin7.next(), itrin8.next(), itrin9.next(), itrin10.next(), itrout.next());
}
};
};
@OpField(names = "engine.adapt")
public final Function, Computers.Arity11, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable>> liftComputer11 =
(computer) -> {
return (in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, out) -> {
Iterator itrin1 = in1.iterator();
Iterator itrin2 = in2.iterator();
Iterator itrin3 = in3.iterator();
Iterator itrin4 = in4.iterator();
Iterator itrin5 = in5.iterator();
Iterator itrin6 = in6.iterator();
Iterator itrin7 = in7.iterator();
Iterator itrin8 = in8.iterator();
Iterator itrin9 = in9.iterator();
Iterator itrin10 = in10.iterator();
Iterator itrin11 = in11.iterator();
Iterator itrout = out.iterator();
while (itrin1.hasNext() && itrin2.hasNext() && itrin3.hasNext() && itrin4.hasNext() && itrin5.hasNext() && itrin6.hasNext() && itrin7.hasNext() && itrin8.hasNext() && itrin9.hasNext() && itrin10.hasNext() && itrin11.hasNext() && itrout.hasNext()) {
computer.compute(itrin1.next(), itrin2.next(), itrin3.next(), itrin4.next(), itrin5.next(), itrin6.next(), itrin7.next(), itrin8.next(), itrin9.next(), itrin10.next(), itrin11.next(), itrout.next());
}
};
};
@OpField(names = "engine.adapt")
public final Function, Computers.Arity12, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable>> liftComputer12 =
(computer) -> {
return (in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, out) -> {
Iterator itrin1 = in1.iterator();
Iterator itrin2 = in2.iterator();
Iterator itrin3 = in3.iterator();
Iterator itrin4 = in4.iterator();
Iterator itrin5 = in5.iterator();
Iterator itrin6 = in6.iterator();
Iterator itrin7 = in7.iterator();
Iterator itrin8 = in8.iterator();
Iterator itrin9 = in9.iterator();
Iterator itrin10 = in10.iterator();
Iterator itrin11 = in11.iterator();
Iterator itrin12 = in12.iterator();
Iterator itrout = out.iterator();
while (itrin1.hasNext() && itrin2.hasNext() && itrin3.hasNext() && itrin4.hasNext() && itrin5.hasNext() && itrin6.hasNext() && itrin7.hasNext() && itrin8.hasNext() && itrin9.hasNext() && itrin10.hasNext() && itrin11.hasNext() && itrin12.hasNext() && itrout.hasNext()) {
computer.compute(itrin1.next(), itrin2.next(), itrin3.next(), itrin4.next(), itrin5.next(), itrin6.next(), itrin7.next(), itrin8.next(), itrin9.next(), itrin10.next(), itrin11.next(), itrin12.next(), itrout.next());
}
};
};
@OpField(names = "engine.adapt")
public final Function, Computers.Arity13, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable>> liftComputer13 =
(computer) -> {
return (in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, out) -> {
Iterator itrin1 = in1.iterator();
Iterator itrin2 = in2.iterator();
Iterator itrin3 = in3.iterator();
Iterator itrin4 = in4.iterator();
Iterator itrin5 = in5.iterator();
Iterator itrin6 = in6.iterator();
Iterator itrin7 = in7.iterator();
Iterator itrin8 = in8.iterator();
Iterator itrin9 = in9.iterator();
Iterator itrin10 = in10.iterator();
Iterator itrin11 = in11.iterator();
Iterator itrin12 = in12.iterator();
Iterator itrin13 = in13.iterator();
Iterator itrout = out.iterator();
while (itrin1.hasNext() && itrin2.hasNext() && itrin3.hasNext() && itrin4.hasNext() && itrin5.hasNext() && itrin6.hasNext() && itrin7.hasNext() && itrin8.hasNext() && itrin9.hasNext() && itrin10.hasNext() && itrin11.hasNext() && itrin12.hasNext() && itrin13.hasNext() && itrout.hasNext()) {
computer.compute(itrin1.next(), itrin2.next(), itrin3.next(), itrin4.next(), itrin5.next(), itrin6.next(), itrin7.next(), itrin8.next(), itrin9.next(), itrin10.next(), itrin11.next(), itrin12.next(), itrin13.next(), itrout.next());
}
};
};
@OpField(names = "engine.adapt")
public final Function, Computers.Arity14, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable, Iterable>> liftComputer14 =
(computer) -> {
return (in1, in2, in3, in4, in5, in6, in7, in8, in9, in10, in11, in12, in13, in14, out) -> {
Iterator itrin1 = in1.iterator();
Iterator itrin2 = in2.iterator();
Iterator itrin3 = in3.iterator();
Iterator itrin4 = in4.iterator();
Iterator itrin5 = in5.iterator();
Iterator itrin6 = in6.iterator();
Iterator itrin7 = in7.iterator();
Iterator itrin8 = in8.iterator();
Iterator itrin9 = in9.iterator();
Iterator itrin10 = in10.iterator();
Iterator