3232import java .lang .reflect .Type ;
3333
3434import org .scijava .ops .core .builder .OpBuilder ;
35- import org .scijava .ops .matcher . OpMatcher ;
35+ import org .scijava .ops .hints . Hints ;
3636import org .scijava .ops .matcher .OpRef ;
3737import org .scijava .types .Nil ;
3838
5656 * </ul>
5757 *
5858 * @author Curtis Rueden
59+ * @author Gabriel Selzer
5960 */
6061public interface OpEnvironment {
6162
@@ -64,12 +65,73 @@ public interface OpEnvironment {
6465
6566 Iterable <OpInfo > infos (String name );
6667
68+ Iterable <OpInfo > infos (Hints hints );
69+
70+ Iterable <OpInfo > infos (String name , Hints hints );
71+
6772 // TODO: Add interface method: OpInfo info(final String opName, final Nil<T> specialType, final Nil<?>[] inTypes, final Nil<?> outType);
6873
69- <T > T op (final String opName , final Nil <T > specialType , final Nil <?>[] inTypes , final Nil <?> outType );
74+ /**
75+ * Returns an Op fitting the provided arguments. NB implementations of this
76+ * method likely depend on the {@link Hints} set by
77+ * {@link OpEnvironment#setHints(Hints)}, which provides no guarantee of
78+ * thread-safety. Users interested in parallel Op matching should consider
79+ * using {@link OpEnvironment#op(String, Nil, Nil[], Nil, Hints)} instead.
80+ *
81+ * @param <T> the {@link Type} of the Op
82+ * @param opName the name of the Op
83+ * @param specialType the generic {@link Type} of the Op
84+ * @param inTypes the arguments (inputs) to the Op
85+ * @param outType the return of the Op (note that it may also be an argument)
86+ * @return an instance of an Op aligning with the search parameters
87+ */
88+ <T > T op (final String opName , final Nil <T > specialType ,
89+ final Nil <?>[] inTypes , final Nil <?> outType );
7090
91+ /**
92+ * Returns an Op fitting the provided arguments. NB implementations of this
93+ * method likely depend on the {@link Hints} set by
94+ * {@link OpEnvironment#setHints(Hints)}, which provides no guarantee of
95+ * thread-safety. Users interested in parallel Op matching should consider
96+ * using {@link OpEnvironment#op(String, Nil, Nil[], Nil, Hints)} instead.
97+ *
98+ * @param <T> the {@link Type} of the Op
99+ * @param info the {@link OpInfo}
100+ * @param specialType the generic {@link Type} of the Op
101+ * @param inTypes the arguments (inputs) to the Op
102+ * @param outType the return of the Op (note that it may also be an argument)
103+ * @return an instance of an Op aligning with the search parameters
104+ */
71105 <T > T op (OpInfo info , Nil <T > specialType , Nil <?>[] inTypes , Nil <?> outType );
72106
107+ /**
108+ * Returns an Op fitting the provided arguments.
109+ *
110+ * @param <T> the {@link Type} of the Op
111+ * @param opName the name of the Op
112+ * @param specialType the generic {@link Type} of the Op
113+ * @param inTypes the arguments (inputs) to the Op
114+ * @param outType the return of the Op (note that it may also be an argument)
115+ * @param hints the {@link Hints} that should guide this matching call
116+ * @return an instance of an Op aligning with the search parameters
117+ */
118+ <T > T op (final String opName , final Nil <T > specialType ,
119+ final Nil <?>[] inTypes , final Nil <?> outType , Hints hints );
120+
121+ /**
122+ * Returns an Op fitting the provided arguments.
123+ *
124+ * @param <T> the {@link Type} of the Op
125+ * @param info the {@link OpInfo}
126+ * @param specialType the generic {@link Type} of the Op
127+ * @param inTypes the arguments (inputs) to the Op
128+ * @param outType the return of the Op (note that it may also be an argument)
129+ * @param hints the {@link Hints} that should guide this matching call
130+ * @return an instance of an Op aligning with the search parameters
131+ */
132+ <T > T op (OpInfo info , Nil <T > specialType , Nil <?>[] inTypes , Nil <?> outType ,
133+ Hints hints );
134+
73135 default OpBuilder op (final String opName ) {
74136 return new OpBuilder (this , opName );
75137 }
@@ -139,4 +201,22 @@ default OpBuilder op(final String opName) {
139201 * @param name
140202 */
141203 void register (OpInfo info , String name );
204+
205+ /**
206+ * Sets the {@link Hints} for the {@link OpEnvironment}. Every Call to
207+ * {@link #op} that <b>does not</b> pass a {@link Hints} will <b>copy</b> the
208+ * Hints passed here (to prevent multiple Op calls from accessing/changing the
209+ * same {@link Hints}). In the case that <b>no {@link Hints} have been
210+ * given</b> to the Environment before {@code op} is called, the
211+ * implementation will create a suitable stand-in.
212+ * <p>
213+ * Note that this method does not inherently provide <b>any</b> guarantees
214+ * pertaining to thread-safety; this API is provided purely for convenience.
215+ * Any calls to {@link OpEnvironment#op(String, Nil, Nil[], Nil)} that require
216+ * a specific {@Hints} should <not> use this method, instead opting for
217+ * {@link OpEnvironment#op(String, Nil, Nil[], Nil, Hints)}.
218+ *
219+ * @param hints
220+ */
221+ void setHints (Hints hints );
142222}
0 commit comments