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

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

commit 5208caf82e51031a4775642d133775e137d7a1b7
Author: Bertty Contreras-Rojas <[email protected]>
AuthorDate: Tue Apr 6 00:04:52 2021 -0400

    [WAYANG-28] Add HackitIterator and basic functionallity
---
 .../hackit/core/iterator/FunctionIterator.java     | 43 ++++++++++++++++++++++
 .../hackit/core/iterator/HackitIterator.java       | 31 ++++++++++++++++
 2 files changed, 74 insertions(+)

diff --git 
a/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/iterator/FunctionIterator.java
 
b/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/iterator/FunctionIterator.java
new file mode 100644
index 0000000..286566f
--- /dev/null
+++ 
b/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/iterator/FunctionIterator.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wayang.plugin.hackit.core.iterator;
+
+import java.io.Serializable;
+import java.util.Iterator;
+import java.util.function.Function;
+
+public class FunctionIterator<I, O> implements Iterator<O>, Serializable {
+
+    private Iterator<I> base;
+    private Function<I, O> function;
+
+    public FunctionIterator(Iterator<I> base, Function<I, O> function) {
+        this.base = base;
+        this.function = function;
+    }
+
+    @Override
+    public boolean hasNext() {
+        return this.base.hasNext();
+    }
+
+    @Override
+    public O next() {
+        return this.function.apply(this.base.next());
+    }
+}
diff --git 
a/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/iterator/HackitIterator.java
 
b/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/iterator/HackitIterator.java
new file mode 100644
index 0000000..3ce2f84
--- /dev/null
+++ 
b/wayang-plugins/wayang-hackit/wayang-hackit-core/src/main/java/org/apache/wayang/plugin/hackit/core/iterator/HackitIterator.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wayang.plugin.hackit.core.iterator;
+
+import org.apache.wayang.plugin.hackit.core.tuple.HackitTuple;
+
+import java.util.Iterator;
+import java.util.function.Function;
+
+
+public class HackitIterator<K, T> extends FunctionIterator<T, HackitTuple<K, 
T>>{
+
+    public HackitIterator(Iterator<T> base, Function<T, HackitTuple<K, T>> 
function) {
+        super(base, function);
+    }
+}

Reply via email to