3535
3636/**
3737 * An {@link OpInstance} with state
38- * <p>
39- * Each {@link RichOp} has <b>one</b> {@link OpInstance}, and <b>one</b>
40- * </p>
41- *
38+ *
4239 * @author Gabriel Selzer
4340 * @param <T> the functional {@link Type} of the wrapped Op
4441 */
4542public interface RichOp <T > extends GenericTyped {
4643
44+ /**
45+ * Gets the {@link OpInstance} of this {@link RichOp}
46+ *
47+ * @return the {@link OpInstance} of this {@link RichOp}
48+ */
4749 OpInstance <T > instance ();
4850
4951 OpEnvironment env ();
5052
5153 Hints hints ();
5254
55+ /**
56+ * Getter for this {@link RichOp}'s <b>raw</b> Op instance
57+ *
58+ * @return the raw Op instance of this {@link RichOp}
59+ */
5360 default T op () {
5461 return instance ().op ();
5562 }
5663
64+ /**
65+ * Getter for this {@link RichOp}'s functional {@link Type}
66+ *
67+ * @return the {@link Type} of this Op
68+ */
69+
5770 @ Override
5871 default Type getType () {
5972 return instance ().getType ();
6073 }
6174
75+ /**
76+ * Getter for this {@link RichOp}'s {@link InfoTree}
77+ *
78+ * @return the {@link InfoTree} describing the construction of this Op
79+ */
6280 default InfoTree infoTree () {
6381 return instance ().infoTree ();
6482 }
@@ -70,11 +88,37 @@ default InfoTree infoTree() {
7088 */
7189 T asOpType ();
7290
73- void preprocess (Object ... inputs );
91+ /**
92+ * Defines behavior performed by the Op before <em>each</em> execution.
93+ *
94+ * @param inputs the inputs to the Op's functional method
95+ */
96+ default void preprocess (Object ... inputs ) {
97+ // By default, do nothing
98+ }
7499
75- void postprocess (Object output );
100+ /**
101+ * Defines behavior performed by the Op after <em>each</em> execution.
102+ *
103+ * @param output the output of the Op's functional method
104+ */
105+ default void postprocess (Object output ) {
106+ // By default, do nothing
107+ }
76108
109+ /**
110+ * Returns true iff this {@link RichOp} is logging its executions in its
111+ * {@link OpHistory}
112+ *
113+ * @return true iff it is recording its executions
114+ */
77115 boolean isRecordingExecutions ();
78116
117+ /**
118+ * Designates whether this {@link RichOp} should log its executions to its
119+ * {@link OpHistory}
120+ *
121+ * @param record tells this {@link RichOp} to record its executions iff true.
122+ */
79123 void recordExecutions (boolean record );
80124}
0 commit comments