This is an automated email from the ASF dual-hosted git repository.

bertty pushed a commit to branch WAYANG-28
in repository https://gitbox.apache.org/repos/asf/incubator-wayang.git

commit 0890650638428cac7a1a37392855a5cf796a27b9
Author: Bertty Contreras-Rojas <[email protected]>
AuthorDate: Wed May 5 00:39:03 2021 -0400

    [WAYANG-28] Add javadoc to tagger package
---
 .../plugin/hackit/core/tagger/HackitTagger.java    | 76 ++++++++++++++++++++++
 .../plugin/hackit/core/tagger/TaggerFunction.java  | 19 +++++-
 .../core/tagger/wrapper/FlatmapWrapperHackit.java  | 21 +++++-
 .../core/tagger/wrapper/FunctionWrapperHackit.java | 22 ++++++-
 .../tagger/wrapper/PredicateWrapperHackit.java     | 21 +++++-
 .../tagger/wrapper/template/FlatMapTemplate.java   | 15 +++++
 .../tagger/wrapper/template/FunctionTemplate.java  | 13 ++++
 7 files changed, 180 insertions(+), 7 deletions(-)

diff --git 
a/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/tagger/HackitTagger.java
 
b/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/tagger/HackitTagger.java
index 87a01c9..48002de 100644
--- 
a/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/tagger/HackitTagger.java
+++ 
b/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/tagger/HackitTagger.java
@@ -27,13 +27,38 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
+/**
+ * HackitTagger is class where is allocated all the logic that need to be 
perform during the
+ * tagging step in Hackit, this logic have and pre and post processing and 
they are acting like
+ * template that follow same behaivor in every tagger
+ */
 public class HackitTagger implements Serializable {
 
+    /**
+     * {@link List} of {@link HackitTag} that are added previous of the 
execution of the
+     * original function
+     */
+    //TODO: It may change by a set
     protected List<HackitTag> pre_tags;
+
+    /**
+     * {@link List} of {@link HackitTag} that are added after of the execution 
of the
+     * original function
+     */
+    //TODO: It may change by a set
     protected List<HackitTag> post_tags;
 
+    /**
+     * Default Construct
+     */
     public HackitTagger(){}
 
+    /**
+     * Add a {@link HackitTag} to {@link List} of <code>pre_tags</code>
+     *
+     * @param tag is a {@link HackitTag} added to change the future behavior
+     * @return {@link HackitTagger} as it self reference
+     */
     public HackitTagger addPreTag(HackitTag tag){
         if(this.pre_tags == null){
             this.pre_tags = new ArrayList<>();
@@ -42,6 +67,12 @@ public class HackitTagger implements Serializable {
         return this;
     }
 
+    /**
+     * Add a {@link HackitTag} to {@link List} of <code>post_tags</code>
+     *
+     * @param tag is a {@link HackitTag} added to change the future behavior
+     * @return {@link HackitTagger} as it self reference
+     */
     public HackitTagger addPostTag(HackitTag tag){
         if(this.post_tags == null){
             this.post_tags = new ArrayList<>();
@@ -50,20 +81,51 @@ public class HackitTagger implements Serializable {
         return this;
     }
 
+    /**
+     * add to the {@link HackitTuple} all the {@link HackitTag}'s add 
pre-tagging phase are available at that moment
+     *
+     * @param tuple is a {@link HackitTuple} where that {@link HackitTag} will 
be added
+     */
     public void preTaggingTuple(HackitTuple tuple){
         if(this.pre_tags != null)
             taggingTuple(tuple, this.pre_tags);
     }
 
+    /**
+     * add to the {@link HackitTuple} all the {@link HackitTag}'s add 
post-tagging phase are available at that moment
+     *
+     * @param tuple is a {@link HackitTuple} where that {@link HackitTag} will 
be added
+     */
     public void postTaggingTuple(HackitTuple tuple){
         if(this.post_tags != null)
             taggingTuple(tuple, this.post_tags);
     }
 
+    /**
+     * add all the {@link HackitTag}'s available on the {@link List} to the 
{@link HackitTuple}
+     *
+     * @param tuple is {@link HackitTuple} where the tags will be added
+     * @param tags {@link List} of {@link HackitTag}'s that will add to {@link 
HackitTuple}
+     */
     public void taggingTuple(HackitTuple tuple, List<HackitTag> tags){
+        //TODO: change this code for an efficient one
         tags.stream().forEach(tag -> tuple.addTag(tag.getInstance()));
     }
 
+    /**
+     * It take the original {@link HackitTuple} and extract the {@link Header} 
and start creating the children
+     * from that {@link Header} this enable to follow the lineage of the after 
a several elements come out from
+     * one {@link HackitTuple}. This generation is possible by inserting a new 
step at the iterator using {@link HackitIterator}
+     * that allow append a new instruction in the process that will be perform 
on the original {@link Iterator}
+     *
+     * @param origin Original {@link HackitTuple} that it was transformed
+     * @param result is the transformation output inside of an {@link Iterator}
+     * @param <K> type of the identifier of {@link HackitTuple}
+     * @param <I> type of the original element inside of {@link HackitTuple} 
that it was transformed
+     * @param <O> type of the output in the transformation
+     *
+     * @return {@link Iterator} that is wrapper of the original with the add 
instruction using {@link HackitIterator}
+     */
     public <K, I, O> Iterator<HackitTuple<K,O>> 
postTaggingTuple(HackitTuple<K, I> origin, Iterator<O>result){
         Header<K> header = origin.getHeader();
         Iterator<HackitTuple<K, O>> iter_result = new HackitIterator<K, O>(
@@ -80,6 +142,20 @@ public class HackitTagger implements Serializable {
         return iter_result;
     }
 
+    /**
+     * It take the original {@link HackitTuple} and extract the {@link Header} 
to be enable to follow the lineage of the
+     * same value transformed, then is generate a new {@link HackitTuple} with 
the <code>result</code> as the wrapped
+     * element, it also add the new {@link HackitTag}'s to the {@link Header}
+     *
+     *
+     * @param origin Original {@link HackitTuple} that it was transformed
+     * @param result is the transformation output
+     * @param <K> type of the identifier of {@link HackitTuple}
+     * @param <I> type of the original element inside of {@link HackitTuple} 
that it was transformed
+     * @param <O> type of the output in the transformation
+     *
+     * @return {@link HackitTuple} with the new {@link HackitTag}
+     */
     public <K, I, O> HackitTuple<K, O> postTaggingTuple(HackitTuple<K, I> 
origin, O result){
         HackitTuple<K, O> hackItTuple_result = new HackitTuple<K, 
O>(origin.getHeader(), result);
         this.postTaggingTuple(hackItTuple_result);
diff --git 
a/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/tagger/TaggerFunction.java
 
b/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/tagger/TaggerFunction.java
index 186b327..eb26a4b 100644
--- 
a/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/tagger/TaggerFunction.java
+++ 
b/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/tagger/TaggerFunction.java
@@ -17,9 +17,24 @@
  */
 package org.apache.wayang.plugin.hackit.core.tagger;
 
+/**
+ * TaggerFunction is the template for the function that will be use inside of 
{@link HackitTagger}
+ *
+ * @param <T> output type of the execution
+ */
 public interface TaggerFunction<T> {
-    public T execute();
+    /**
+     * It execute the function of tagger, and generate and output
+     *
+     * @return result of the execution
+     */
+    T execute();
 
-    public String getName();
+    /**
+     * Get the name of the function, this is use a identifier
+     *
+     * @return {@link String} that contains the name of the {@link 
TaggerFunction}
+     */
+    String getName();
 
 }
diff --git 
a/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/tagger/wrapper/FlatmapWrapperHackit.java
 
b/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/tagger/wrapper/FlatmapWrapperHackit.java
index a57cd23..9100c99 100644
--- 
a/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/tagger/wrapper/FlatmapWrapperHackit.java
+++ 
b/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/tagger/wrapper/FlatmapWrapperHackit.java
@@ -23,15 +23,30 @@ import 
org.apache.wayang.plugin.hackit.core.tuple.HackitTuple;
 
 import java.util.Iterator;
 
+/**
+ * FlatmapWrapperHackit is an implementation of {@link FlatMapTemplate} where 
Hackit manage the logic
+ * before and after of tagging process, also it perform the unwrap of the 
tuple to be handle by the
+ * original function
+ *
+ * @param <IDType> Type of {@link 
org.apache.wayang.plugin.hackit.core.tuple.header.Header} key of the {@link 
HackitTuple}
+ * @param <I> Input Type of the original Tuple
+ * @param <O> Output Type after the perform the Function
+ */
 public class FlatmapWrapperHackit<IDType, I, O>
         extends HackitTagger
         implements FlatMapTemplate<HackitTuple<IDType, I>, HackitTuple<IDType, 
O>> {
 
+    /**
+     * Original function that will transform the data
+     */
     private FlatMapTemplate<I, O> function;
 
-    public FlatmapWrapperHackit(
-            FlatMapTemplate<I, O> function
-    ) {
+    /**
+     * Default Construct
+     *
+     * @param function is the function that will be Wrapped by the {@link 
FlatmapWrapperHackit}
+     */
+    public FlatmapWrapperHackit( FlatMapTemplate<I, O> function ) {
         this.function = function;
     }
 
diff --git 
a/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/tagger/wrapper/FunctionWrapperHackit.java
 
b/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/tagger/wrapper/FunctionWrapperHackit.java
index c244eb0..99e4b37 100644
--- 
a/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/tagger/wrapper/FunctionWrapperHackit.java
+++ 
b/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/tagger/wrapper/FunctionWrapperHackit.java
@@ -18,13 +18,33 @@
 package org.apache.wayang.plugin.hackit.core.tagger.wrapper;
 
 import org.apache.wayang.plugin.hackit.core.tagger.HackitTagger;
+import 
org.apache.wayang.plugin.hackit.core.tagger.wrapper.template.FlatMapTemplate;
 import 
org.apache.wayang.plugin.hackit.core.tagger.wrapper.template.FunctionTemplate;
 import org.apache.wayang.plugin.hackit.core.tuple.HackitTuple;
 
-public class FunctionWrapperHackit <IDType, I, O> extends HackitTagger 
implements FunctionTemplate<HackitTuple<IDType, I>, HackitTuple<IDType, O>> {
+/**
+ * FunctionWrapperHackit is an implementation of {@link FunctionTemplate} 
where Hackit manage the logic
+ * before and after of tagging process, also it perform the unwrap of the 
tuple to be handle by the
+ * original function
+ *
+ * @param <IDType> Type of {@link 
org.apache.wayang.plugin.hackit.core.tuple.header.Header} key of the {@link 
HackitTuple}
+ * @param <I> Input Type of the original Tuple
+ * @param <O> Output Type after the perform the Function
+ */
+public class FunctionWrapperHackit <IDType, I, O>
+        extends HackitTagger
+        implements FunctionTemplate<HackitTuple<IDType, I>, 
HackitTuple<IDType, O>> {
 
+    /**
+     * Original function that will transform the data
+     */
     private FunctionTemplate<I, O> function;
 
+    /**
+     * Default Construct
+     *
+     * @param function is the function that will be Wrapped by the {@link 
FunctionWrapperHackit}
+     */
     public FunctionWrapperHackit(FunctionTemplate<I, O> function) {
         this.function = function;
     }
diff --git 
a/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/tagger/wrapper/PredicateWrapperHackit.java
 
b/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/tagger/wrapper/PredicateWrapperHackit.java
index c2636e2..7249fdf 100644
--- 
a/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/tagger/wrapper/PredicateWrapperHackit.java
+++ 
b/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/tagger/wrapper/PredicateWrapperHackit.java
@@ -21,10 +21,29 @@ import 
org.apache.wayang.plugin.hackit.core.tagger.HackitTagger;
 import 
org.apache.wayang.plugin.hackit.core.tagger.wrapper.template.FunctionTemplate;
 import org.apache.wayang.plugin.hackit.core.tuple.HackitTuple;
 
-public class PredicateWrapperHackit<IDType, I> extends HackitTagger implements 
FunctionTemplate<HackitTuple<IDType, I>, Boolean> {
+/**
+ * PredicateWrapperHackit is an implementation of {@link FunctionTemplate} 
where Hackit manage the logic
+ * before and after of tagging process, also it perform the unwrap of the 
tuple to be handle by the
+ * original function. The original {@link FunctionTemplate} it an predicate 
function because return a
+ * {@link Boolean}
+ *
+ * @param <IDType> Type of {@link 
org.apache.wayang.plugin.hackit.core.tuple.header.Header} key of the {@link 
HackitTuple}
+ * @param <I> Input Type of the original Tuple to be evaluated
+ */
+public class PredicateWrapperHackit<IDType, I>
+        extends HackitTagger
+        implements FunctionTemplate<HackitTuple<IDType, I>, Boolean> {
 
+    /**
+     * Original predicate that will evaluate the data to give a True or False 
value
+     */
     private FunctionTemplate<I, Boolean> function;
 
+    /**
+     * Default Construct
+     *
+     * @param function is the predicate that will be Wrapped by the {@link 
PredicateWrapperHackit}
+     */
     public PredicateWrapperHackit(FunctionTemplate<I, Boolean> function) {
         this.function = function;
     }
diff --git 
a/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/tagger/wrapper/template/FlatMapTemplate.java
 
b/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/tagger/wrapper/template/FlatMapTemplate.java
index abe6471..6c68f0c 100644
--- 
a/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/tagger/wrapper/template/FlatMapTemplate.java
+++ 
b/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/tagger/wrapper/template/FlatMapTemplate.java
@@ -19,7 +19,22 @@ package 
org.apache.wayang.plugin.hackit.core.tagger.wrapper.template;
 
 import java.util.Iterator;
 
+/**
+ * FlatMapTemplate is the template that provide the abstraction to work with 
Flatmap operations and also
+ * allows to wrap some function made by the user.
+ *
+ * FlatMapTemplate generate as output a {@link Iterator} this could be an 
extension of {@link 
org.apache.wayang.plugin.hackit.core.iterator.HackitIterator}
+ *
+ * @param <I> Input type of the original Function
+ * @param <O> Output type of the original function
+ */
 public interface FlatMapTemplate<I, O> {
 
+    /**
+     * Execute the logic over one element and generate as output a {@link 
Iterator}
+     *
+     * @param input element to transform
+     * @return {@link Iterator} that contains the output's
+     */
     public Iterator<O> execute(I input);
 }
diff --git 
a/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/tagger/wrapper/template/FunctionTemplate.java
 
b/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/tagger/wrapper/template/FunctionTemplate.java
index 9e5cb65..e33ad77 100644
--- 
a/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/tagger/wrapper/template/FunctionTemplate.java
+++ 
b/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/tagger/wrapper/template/FunctionTemplate.java
@@ -17,7 +17,20 @@
  */
 package org.apache.wayang.plugin.hackit.core.tagger.wrapper.template;
 
+/**
+ * FunctionTemplate is the template that provide the abstraction to work with 
Transformation operations and also
+ * allows to wrap some function made by the user.
+ *
+ * @param <I> Input type of the original Function
+ * @param <O> Output type of the original function
+ */
 public interface FunctionTemplate<I, O> {
 
+    /**
+     * Execute the logic over one element and generate as output <code>T</code>
+     *
+     * @param input element to transform
+     * @return <code>O</code> that is the transformation of the 
<code>input</code>
+     */
     public O execute(I input);
 }

Reply via email to