Template:GitHubEmbed

Example

{{GitHubEmbed
| org = imagej
| repo = imagej-ops
| source = net/imagej/ops/Op.java
}}

net/imagej/ops/Op.java

package net.imagej.ops;

import org.scijava.command.Command;
import org.scijava.plugin.Plugin;
import org.scijava.plugin.PluginService;

/**
 * An <em>op</em> is an operation that computes a result in a deterministic and
 * consistent way.
 * <p>
 * <p>
 * Ops discoverable at runtime must implement this interface and be annotated
 * with @{@link Plugin} with attribute {@link Plugin#type()} = {@link Op}.class
 * or a subtype thereof (see the interfaces of {@link Ops}). While it is
 * possible to create an op merely by implementing this interface, it is
 * encouraged to instead extend {@link AbstractOp}, for convenience.
 * </p>
 * <h2>Naming and matching</h2>
 * <p>
 * Each op has a name (provided in the {@link Plugin#name()} attribute, which is
 * not necessarily unique. This allows multiple "overloaded" ops with different
 * combinations of parameter types, similar to the method overloading feature of
 * Java and other programming languages. The
 * {@link OpService#op(String, Object...)} and
 * {@link OpService#run(String, Object...)} methods can be used to obtain and
 * execute (respectively) the best matching op instances for a given name and
 * set of input arguments.
 * <p>
 * An op may optionally have a namespace. This is analogous to packages in Java
 * and similar features in other languages. The namespace is expressed as a
 * prefix; such ops are referenced by their namespace, followed by a dot,
 * followed by the op name. Ops without a namespace belong to the "global"
 * namespace, with no prefix or dot. Two ops with the same name but different
 * namespaces only partially "overload" or "override" one other; see
 * {@link OpService#run(String, Object...)} for details.
 * </p>
 * <p>
 * The naming convention for both namespaces and op names is to use an
 * alphameric string, in lower camel case.
 * </p>
 * <h2>Comparison with {@link Command}</h2>
 * <p>
 * Every op is a {@link Command}. And like {@link Command}s, ops may have
 * multiple inputs and multiple outputs. However, ops impose some additional
 * requirements beyond those of regular {@link Command}s:
 * </p>
 * <ul>
 * <li>Op arguments are fixed: an op may not dynamically alter the number or
 * types of its arguments.</li>
 * <li>Calling the same op twice with the same argument values must result in
 * the same result (for a given op execution environment).</li>
 * </ul>
 * 
 * @author Curtis Rueden
 * @see Plugin
 * @see PluginService
 */
public interface Op extends Command, Environmental {
	// NB: Marker interface.
}