You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@giraph.apache.org by ik...@apache.org on 2016/03/19 00:49:58 UTC
[1/2] git commit: updated refs/heads/trunk to a927450
Repository: giraph
Updated Branches:
refs/heads/trunk e4aa99d3f -> a927450aa
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-core/src/main/java/org/apache/giraph/function/primitive/Int2ObjFunction.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/function/primitive/Int2ObjFunction.java b/giraph-core/src/main/java/org/apache/giraph/function/primitive/Int2ObjFunction.java
new file mode 100644
index 0000000..973c41b
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/function/primitive/Int2ObjFunction.java
@@ -0,0 +1,39 @@
+/*
+ * 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.giraph.function.primitive;
+
+import java.io.Serializable;
+
+/**
+ * Primitive specialization of Function:
+ * (int) -> T
+ *
+ * @param <T> Result type
+ */
+public interface Int2ObjFunction<T> extends Serializable {
+ /**
+ * Returns the result of applying this function to given {@code input}.
+ *
+ * The returned object may or may not be a new instance,
+ * depending on the implementation.
+ *
+ * @param input input
+ * @return result
+ */
+ T apply(int input);
+}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-core/src/main/java/org/apache/giraph/function/primitive/IntConsumer.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/function/primitive/IntConsumer.java b/giraph-core/src/main/java/org/apache/giraph/function/primitive/IntConsumer.java
new file mode 100644
index 0000000..f47ab74
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/function/primitive/IntConsumer.java
@@ -0,0 +1,36 @@
+/*
+ * 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.giraph.function.primitive;
+
+import java.io.Serializable;
+
+// AUTO-GENERATED class via class:
+// org.apache.giraph.generate.GeneratePrimitiveClasses
+
+/**
+ * Primitive specialization of Function:
+ * (int) -> void
+ */
+public interface IntConsumer extends Serializable {
+ /**
+ * Applies this function to {@code input}
+ *
+ * @param input input
+ */
+ void apply(int input);
+}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-core/src/main/java/org/apache/giraph/function/primitive/IntSupplier.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/function/primitive/IntSupplier.java b/giraph-core/src/main/java/org/apache/giraph/function/primitive/IntSupplier.java
new file mode 100644
index 0000000..c71b6d6
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/function/primitive/IntSupplier.java
@@ -0,0 +1,33 @@
+/*
+ * 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.giraph.function.primitive;
+
+import java.io.Serializable;
+
+/**
+ * Primitive specialization of Function:
+ * () -> int
+ */
+public interface IntSupplier extends Serializable {
+ /**
+ * Retrieves an int value.
+ *
+ * @return result
+ */
+ int get();
+}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-core/src/main/java/org/apache/giraph/function/primitive/LongConsumer.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/function/primitive/LongConsumer.java b/giraph-core/src/main/java/org/apache/giraph/function/primitive/LongConsumer.java
new file mode 100644
index 0000000..6ad9f80
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/function/primitive/LongConsumer.java
@@ -0,0 +1,36 @@
+/*
+ * 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.giraph.function.primitive;
+
+import java.io.Serializable;
+
+// AUTO-GENERATED class via class:
+// org.apache.giraph.generate.GeneratePrimitiveClasses
+
+/**
+ * Primitive specialization of Function:
+ * (long) -> void
+ */
+public interface LongConsumer extends Serializable {
+ /**
+ * Applies this function to {@code input}
+ *
+ * @param input input
+ */
+ void apply(long input);
+}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-core/src/main/java/org/apache/giraph/function/primitive/Obj2BooleanFunction.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/function/primitive/Obj2BooleanFunction.java b/giraph-core/src/main/java/org/apache/giraph/function/primitive/Obj2BooleanFunction.java
new file mode 100644
index 0000000..0e39fca
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/function/primitive/Obj2BooleanFunction.java
@@ -0,0 +1,39 @@
+/*
+ * 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.giraph.function.primitive;
+
+import java.io.Serializable;
+
+// AUTO-GENERATED class via class:
+// org.apache.giraph.generate.GeneratePrimitiveClasses
+
+/**
+ * Primitive specialization of Function:
+ * (T) -> boolean
+ *
+ * @param <T> Argument type
+ */
+public interface Obj2BooleanFunction<T> extends Serializable {
+ /**
+ * Returns the result of applying this function to given {@code input}.
+ *
+ * @param input input
+ * @return result
+ */
+ boolean apply(T input);
+}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-core/src/main/java/org/apache/giraph/function/primitive/Obj2ByteFunction.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/function/primitive/Obj2ByteFunction.java b/giraph-core/src/main/java/org/apache/giraph/function/primitive/Obj2ByteFunction.java
new file mode 100644
index 0000000..88d1ed3
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/function/primitive/Obj2ByteFunction.java
@@ -0,0 +1,39 @@
+/*
+ * 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.giraph.function.primitive;
+
+import java.io.Serializable;
+
+// AUTO-GENERATED class via class:
+// org.apache.giraph.generate.GeneratePrimitiveClasses
+
+/**
+ * Primitive specialization of Function:
+ * (T) -> byte
+ *
+ * @param <T> Argument type
+ */
+public interface Obj2ByteFunction<T> extends Serializable {
+ /**
+ * Returns the result of applying this function to given {@code input}.
+ *
+ * @param input input
+ * @return result
+ */
+ byte apply(T input);
+}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-core/src/main/java/org/apache/giraph/function/primitive/Obj2DoubleFunction.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/function/primitive/Obj2DoubleFunction.java b/giraph-core/src/main/java/org/apache/giraph/function/primitive/Obj2DoubleFunction.java
new file mode 100644
index 0000000..11b0fdf
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/function/primitive/Obj2DoubleFunction.java
@@ -0,0 +1,39 @@
+/*
+ * 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.giraph.function.primitive;
+
+import java.io.Serializable;
+
+// AUTO-GENERATED class via class:
+// org.apache.giraph.generate.GeneratePrimitiveClasses
+
+/**
+ * Primitive specialization of Function:
+ * (T) -> double
+ *
+ * @param <T> Argument type
+ */
+public interface Obj2DoubleFunction<T> extends Serializable {
+ /**
+ * Returns the result of applying this function to given {@code input}.
+ *
+ * @param input input
+ * @return result
+ */
+ double apply(T input);
+}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-core/src/main/java/org/apache/giraph/function/primitive/Obj2FloatFunction.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/function/primitive/Obj2FloatFunction.java b/giraph-core/src/main/java/org/apache/giraph/function/primitive/Obj2FloatFunction.java
new file mode 100644
index 0000000..01fb8bc
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/function/primitive/Obj2FloatFunction.java
@@ -0,0 +1,39 @@
+/*
+ * 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.giraph.function.primitive;
+
+import java.io.Serializable;
+
+// AUTO-GENERATED class via class:
+// org.apache.giraph.generate.GeneratePrimitiveClasses
+
+/**
+ * Primitive specialization of Function:
+ * (T) -> float
+ *
+ * @param <T> Argument type
+ */
+public interface Obj2FloatFunction<T> extends Serializable {
+ /**
+ * Returns the result of applying this function to given {@code input}.
+ *
+ * @param input input
+ * @return result
+ */
+ float apply(T input);
+}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-core/src/main/java/org/apache/giraph/function/primitive/Obj2IntFunction.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/function/primitive/Obj2IntFunction.java b/giraph-core/src/main/java/org/apache/giraph/function/primitive/Obj2IntFunction.java
new file mode 100644
index 0000000..628c45e
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/function/primitive/Obj2IntFunction.java
@@ -0,0 +1,39 @@
+/*
+ * 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.giraph.function.primitive;
+
+import java.io.Serializable;
+
+// AUTO-GENERATED class via class:
+// org.apache.giraph.generate.GeneratePrimitiveClasses
+
+/**
+ * Primitive specialization of Function:
+ * (T) -> int
+ *
+ * @param <T> Argument type
+ */
+public interface Obj2IntFunction<T> extends Serializable {
+ /**
+ * Returns the result of applying this function to given {@code input}.
+ *
+ * @param input input
+ * @return result
+ */
+ int apply(T input);
+}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-core/src/main/java/org/apache/giraph/function/primitive/Obj2LongFunction.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/function/primitive/Obj2LongFunction.java b/giraph-core/src/main/java/org/apache/giraph/function/primitive/Obj2LongFunction.java
new file mode 100644
index 0000000..4933523
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/function/primitive/Obj2LongFunction.java
@@ -0,0 +1,39 @@
+/*
+ * 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.giraph.function.primitive;
+
+import java.io.Serializable;
+
+// AUTO-GENERATED class via class:
+// org.apache.giraph.generate.GeneratePrimitiveClasses
+
+/**
+ * Primitive specialization of Function:
+ * (T) -> long
+ *
+ * @param <T> Argument type
+ */
+public interface Obj2LongFunction<T> extends Serializable {
+ /**
+ * Returns the result of applying this function to given {@code input}.
+ *
+ * @param input input
+ * @return result
+ */
+ long apply(T input);
+}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-core/src/main/java/org/apache/giraph/function/primitive/PrimitiveRefs.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/function/primitive/PrimitiveRefs.java b/giraph-core/src/main/java/org/apache/giraph/function/primitive/PrimitiveRefs.java
new file mode 100644
index 0000000..c83676f
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/function/primitive/PrimitiveRefs.java
@@ -0,0 +1,137 @@
+/*
+ * 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.giraph.function.primitive;
+
+/**
+ * Convenience classes holding primitive values - a reference
+ * to a mutable value.
+ * For use when lambdas need to mutate capturing primitive local variable.
+ * (since lambdas cannot capture and modify local variables)
+ */
+public interface PrimitiveRefs {
+
+ // Have public field for convenience, since classes have no logic inside
+ // CHECKSTYLE: stop VisibilityModifierCheck
+
+ /**
+ * Convenience class holding int value,
+ * for use when lambdas need to mutate capturing int local variable.
+ */
+ public class IntRef {
+ /** value */
+ public int value;
+
+ /**
+ * Constructor
+ * @param value initial value
+ */
+ public IntRef(int value) {
+ this.value = value;
+ }
+ }
+
+ /**
+ * Convenience class holding long value,
+ * for use when lambdas need to mutate capturing long local variable.
+ */
+ public class LongRef {
+ /** value */
+ public long value;
+
+ /**
+ * Constructor
+ * @param value initial value
+ */
+ public LongRef(long value) {
+ this.value = value;
+ }
+ }
+
+ /**
+ * Convenience class holding int value,
+ * for use when lambdas need to mutate capturing int local variable.
+ */
+ public class ShortRef {
+ /** value */
+ public short value;
+
+ /**
+ * Constructor
+ * @param value initial value
+ */
+ public ShortRef(short value) {
+ this.value = value;
+ }
+ }
+
+
+ /**
+ * Convenience class holding float value,
+ * for use when lambdas need to mutate capturing float local variable.
+ */
+ public class FloatRef {
+ /** value */
+ public float value;
+
+ /**
+ * Constructor
+ * @param value initial value
+ */
+ public FloatRef(float value) {
+ this.value = value;
+ }
+ }
+
+ /**
+ * Convenience class holding double value,
+ * for use when lambdas need to mutate capturing double local variable.
+ */
+ public class DoubleRef {
+ /** value */
+ public double value;
+
+ /**
+ * Constructor
+ * @param value initial value
+ */
+ public DoubleRef(double value) {
+ this.value = value;
+ }
+ }
+
+ /**
+ * Convenience class holding object values,
+ * for use when lambdas need to mutate capturing object local variable.
+ *
+ * <O> object
+ */
+ public class ObjRef<O> {
+ /** value */
+ public O value;
+
+ /**
+ * Constructor
+ * @param value initial value
+ */
+ public ObjRef(O value) {
+ this.value = value;
+ }
+ }
+
+ // CHECKSTYLE: resume VisibilityModifierCheck
+}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-core/src/main/java/org/apache/giraph/function/primitive/package-info.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/function/primitive/package-info.java b/giraph-core/src/main/java/org/apache/giraph/function/primitive/package-info.java
new file mode 100644
index 0000000..fdf40ff
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/function/primitive/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+/**
+ * Primitive specializations of interfaces from org.apache.giraph.function
+ * package.
+ */
+package org.apache.giraph.function.primitive;
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-core/src/main/java/org/apache/giraph/function/vertex/ConsumerWithVertex.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/function/vertex/ConsumerWithVertex.java b/giraph-core/src/main/java/org/apache/giraph/function/vertex/ConsumerWithVertex.java
new file mode 100644
index 0000000..3b6ba0e
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/function/vertex/ConsumerWithVertex.java
@@ -0,0 +1,51 @@
+/*
+ * 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.giraph.function.vertex;
+
+import java.io.Serializable;
+
+import org.apache.giraph.function.PairConsumer;
+import org.apache.giraph.graph.Vertex;
+import org.apache.hadoop.io.Writable;
+import org.apache.hadoop.io.WritableComparable;
+
+
+/**
+ * Function:
+ * (vertex, T) -> void
+ *
+ * A class that can consume objects of a single type, when given a vertex.
+ *
+ * @param <I> Vertex id type
+ * @param <V> Vertex value type
+ * @param <E> Edge value type
+ * @param <T> Argument type
+ */
+@SuppressWarnings("rawtypes")
+public interface ConsumerWithVertex<I extends WritableComparable,
+ V extends Writable, E extends Writable, T>
+ extends PairConsumer<Vertex<I, V, E>, T>, Serializable {
+ /**
+ * Applies this function to {@code vertex} and {@code input}
+ *
+ * @param vertex Vertex
+ * @param value Value
+ */
+ @Override
+ void apply(Vertex<I, V, E> vertex, T value);
+}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-core/src/main/java/org/apache/giraph/function/vertex/FunctionWithVertex.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/function/vertex/FunctionWithVertex.java b/giraph-core/src/main/java/org/apache/giraph/function/vertex/FunctionWithVertex.java
new file mode 100644
index 0000000..e7552c9
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/function/vertex/FunctionWithVertex.java
@@ -0,0 +1,56 @@
+/*
+ * 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.giraph.function.vertex;
+
+import java.io.Serializable;
+
+import org.apache.giraph.function.PairFunction;
+import org.apache.giraph.graph.Vertex;
+import org.apache.hadoop.io.Writable;
+import org.apache.hadoop.io.WritableComparable;
+
+/**
+ * Function:
+ * (vertex, F) -> T
+ *
+ * Determines an output value based on a vertex and an input value.
+ *
+ * @param <I> Vertex id type
+ * @param <V> Vertex value type
+ * @param <E> Edge value type
+ * @param <F> Argument type
+ * @param <T> Result type
+ */
+@SuppressWarnings("rawtypes")
+public interface FunctionWithVertex<I extends WritableComparable,
+ V extends Writable, E extends Writable, F, T>
+ extends PairFunction<Vertex<I, V, E>, F, T>, Serializable {
+ /**
+ * Returns the result of applying this function to given
+ * {@code vertex} and {@code input}.
+ *
+ * The returned object may or may not be a new instance,
+ * depending on the implementation.
+ *
+ * @param vertex Vertex
+ * @param input Input
+ * @return result
+ */
+ @Override
+ T apply(Vertex<I, V, E> vertex, F input);
+}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-core/src/main/java/org/apache/giraph/function/vertex/SupplierFromVertex.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/function/vertex/SupplierFromVertex.java b/giraph-core/src/main/java/org/apache/giraph/function/vertex/SupplierFromVertex.java
new file mode 100644
index 0000000..bf2a4b1
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/function/vertex/SupplierFromVertex.java
@@ -0,0 +1,52 @@
+/*
+ * 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.giraph.function.vertex;
+
+import java.io.Serializable;
+
+import org.apache.giraph.graph.Vertex;
+import org.apache.hadoop.io.Writable;
+import org.apache.hadoop.io.WritableComparable;
+
+/**
+ * Function:
+ * (vertex) -> T
+ *
+ * A class that can supply objects of a single type, when given a vertex.
+ *
+ * (doesn't extend Function<Vertex<I, V, E>, T>, because of different
+ * method names)
+ *
+ * @param <I> Vertex id type
+ * @param <V> Vertex value type
+ * @param <E> Edge value type
+ * @param <T> Result type
+ */
+@SuppressWarnings("rawtypes")
+public interface SupplierFromVertex<I extends WritableComparable,
+ V extends Writable, E extends Writable, T> extends Serializable {
+ /**
+ * Retrieves an instance of the appropriate type, given a vertex.
+ * The returned object may or may not be a new instance,
+ * depending on the implementation.
+ *
+ * @param vertex Vertex
+ * @return result
+ */
+ T get(Vertex<I, V, E> vertex);
+}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-core/src/main/java/org/apache/giraph/function/vertex/package-info.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/function/vertex/package-info.java b/giraph-core/src/main/java/org/apache/giraph/function/vertex/package-info.java
new file mode 100644
index 0000000..bd5b019
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/function/vertex/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 for interfaces representing functions additionally
+ * performed on vertex values.
+ */
+package org.apache.giraph.function.vertex;
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-core/src/test/java/org/apache/giraph/generate/GeneratePrimitiveClasses.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/test/java/org/apache/giraph/generate/GeneratePrimitiveClasses.java b/giraph-core/src/test/java/org/apache/giraph/generate/GeneratePrimitiveClasses.java
new file mode 100644
index 0000000..95896f6
--- /dev/null
+++ b/giraph-core/src/test/java/org/apache/giraph/generate/GeneratePrimitiveClasses.java
@@ -0,0 +1,185 @@
+/*
+ * 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.giraph.generate;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.Map;
+
+import freemarker.core.ParseException;
+import freemarker.template.Configuration;
+import freemarker.template.MalformedTemplateNameException;
+import freemarker.template.Template;
+import freemarker.template.TemplateException;
+import freemarker.template.TemplateExceptionHandler;
+import freemarker.template.TemplateNotFoundException;
+
+/**
+ * <p>Code generation utility that generates set of classes from a template files.
+ * Templates are found in giraph-core/template/ folder.
+ * If you want to add new generation, look at the main function, and add a call
+ * to appropriate generate* function.</p>
+ *
+ * <p>Templates are using freemarker template format, which given
+ * template file and map of String->Object replacements generates
+ * new file.</p>
+ * Main rules:
+ * <ul>
+ * <li><code>${something}</code> gets replaced with value of <code>map.get("something")</code></li>
+ * <li><code>${obj.method}</code> gets replaced with value of <code>map.get("obj").getMethod()</code></li>
+ * </ul>
+ * More description about template format can be found at:
+ * <a href="http://freemarker.org/docs/dgui_quickstart_template.html">tutorial</a>
+ */
+public class GeneratePrimitiveClasses {
+ // No Short since there is no ShortWritable for some reason
+ public static enum PrimitiveType {
+ BOOLEAN("Boolean", false, false, false),
+ BYTE("Byte", true, false, false),
+ INT("Int", "Integer", true, true, false),
+ LONG("Long", true, true, false),
+ FLOAT("Float", true, false, true),
+ DOUBLE("Double", true, false, true);
+
+ private final String name;
+ private final String boxed;
+ private final boolean numeric;
+ private final boolean id;
+ private final boolean floating;
+
+ private PrimitiveType(String name, String boxed, boolean numeric, boolean id, boolean floating) {
+ this.name = name;
+ this.boxed = boxed;
+ this.numeric = numeric;
+ this.id = id;
+ this.floating = floating;
+ }
+
+ private PrimitiveType(String name, boolean numeric, boolean id, boolean floating) {
+ this(name, name, numeric, id, floating);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getCamel() {
+ return name;
+ }
+
+ public String getLower() {
+ return name.toLowerCase();
+ }
+
+ public String getBoxed() {
+ return boxed;
+ }
+
+ public boolean isNumeric() {
+ return numeric;
+ }
+
+ public boolean isId() {
+ return id;
+ }
+
+ public boolean isFloating() {
+ return floating;
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ /* Create and adjust the configuration singleton */
+ Configuration cfg = new Configuration(Configuration.VERSION_2_3_22);
+ cfg.setDirectoryForTemplateLoading(new File("templates"));
+ cfg.setDefaultEncoding("UTF-8");
+ cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
+
+ generateForAll(
+ cfg,
+ EnumSet.allOf(PrimitiveType.class),
+ "TypeConsumer.java",
+ "src/main/java/org/apache/giraph/function/primitive/%sConsumer.java");
+
+ generateForAll(
+ cfg,
+ EnumSet.allOf(PrimitiveType.class),
+ "Obj2TypeFunction.java",
+ "src/main/java/org/apache/giraph/function/primitive/Obj2%sFunction.java");
+
+// generateForAll(
+// cfg,
+// EnumSet.allOf(PrimitiveType.class),
+// "TypeTypeOps.java",
+// "src/main/java/org/apache/giraph/types/ops/%sTypeOps.java");
+//
+// generateForAll(
+// cfg,
+// EnumSet.allOf(PrimitiveType.class),
+// "WTypeArrayList.java",
+// "src/main/java/org/apache/giraph/types/ops/collections/array/W%sArrayList.java");
+
+ EnumSet<PrimitiveType> ids = EnumSet.noneOf(PrimitiveType.class);
+ for (PrimitiveType type : PrimitiveType.values()) {
+ if (type.isId()) {
+ ids.add(type);
+ }
+ }
+ }
+
+ /**
+ * Generate a set of files from a template, one for each type in the passed set,
+ * where added entry for "type" to that object is added, on top of default entries.
+ */
+ private static void generateForAll(Configuration cfg, EnumSet<PrimitiveType> types,
+ String template, String outputPattern) throws TemplateNotFoundException, MalformedTemplateNameException, ParseException, FileNotFoundException, IOException, TemplateException {
+ for (PrimitiveType type : types) {
+ Map<String, Object> props = defaultMap();
+ props.put("type", type);
+ generateAndWrite(cfg, props,
+ template,
+ String.format(outputPattern, type.getCamel()));
+ }
+ }
+
+ /** Generate a single file from a template, replacing mappings from given properties */
+ private static void generateAndWrite(Configuration cfg, Map<String, Object> props,
+ String template, String outputFile)
+ throws TemplateNotFoundException, MalformedTemplateNameException, ParseException,
+ IOException, FileNotFoundException, TemplateException {
+ Template temp = cfg.getTemplate(template);
+ Writer out = new OutputStreamWriter(new FileOutputStream(outputFile));
+ temp.process(props, out);
+ out.close();
+ }
+
+ public static Map<String, Object> defaultMap() {
+ Map<String, Object> props = new HashMap<>();
+ props.put("generated_message", GENERATED_MESSAGE);
+ return props;
+ }
+
+ private static final String GENERATED_MESSAGE =
+ "// AUTO-GENERATED class via class:\n// " + GeneratePrimitiveClasses.class.getName();
+}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-core/templates/Obj2TypeFunction.java
----------------------------------------------------------------------
diff --git a/giraph-core/templates/Obj2TypeFunction.java b/giraph-core/templates/Obj2TypeFunction.java
new file mode 100644
index 0000000..b256283
--- /dev/null
+++ b/giraph-core/templates/Obj2TypeFunction.java
@@ -0,0 +1,38 @@
+/*
+ * 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.giraph.function.primitive;
+
+import java.io.Serializable;
+
+${generated_message}
+
+/**
+ * Primitive specialization of Function:
+ * (T) -> ${type.lower}
+ *
+ * @param <T> Argument type
+ */
+public interface Obj2${type.camel}Function<T> extends Serializable {
+ /**
+ * Returns the result of applying this function to given {@code input}.
+ *
+ * @param input input
+ * @return result
+ */
+ ${type.lower} apply(T input);
+}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-core/templates/TypeConsumer.java
----------------------------------------------------------------------
diff --git a/giraph-core/templates/TypeConsumer.java b/giraph-core/templates/TypeConsumer.java
new file mode 100644
index 0000000..9bea280
--- /dev/null
+++ b/giraph-core/templates/TypeConsumer.java
@@ -0,0 +1,35 @@
+/*
+ * 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.giraph.function.primitive;
+
+import java.io.Serializable;
+
+${generated_message}
+
+/**
+ * Primitive specialization of Function:
+ * (${type.lower}) -> void
+ */
+public interface ${type.camel}Consumer extends Serializable {
+ /**
+ * Applies this function to {@code input}
+ *
+ * @param input input
+ */
+ void apply(${type.lower} input);
+}
[2/2] git commit: updated refs/heads/trunk to a927450
Posted by ik...@apache.org.
[GIRAPH-1041] Generate primitive type specific code for functions
Summary:
- Use FreeMarker library to generate primitive type specific code.
Initially generating two sets of files:
{TYPE}Consumer, Obj2{TYPE}Function
Right now generation happens manually, and generated files are being committed.
In the future we can move those to a separate project, and have them generated
when maven is compiling and deploying.
Splitting of D52515 into reviewable pieces
Test Plan:
mvn clean install
There are no changes in logic in this diff.
Reviewers: spupyrev, sergey.edunov, dionysis.logothetis, maja.kabiljo
Reviewed By: maja.kabiljo
Differential Revision: https://reviews.facebook.net/D55527
Project: http://git-wip-us.apache.org/repos/asf/giraph/repo
Commit: http://git-wip-us.apache.org/repos/asf/giraph/commit/a927450a
Tree: http://git-wip-us.apache.org/repos/asf/giraph/tree/a927450a
Diff: http://git-wip-us.apache.org/repos/asf/giraph/diff/a927450a
Branch: refs/heads/trunk
Commit: a927450aa63fe8e21f7da22cc79de182cfcfd780
Parents: e4aa99d
Author: Igor Kabiljo <ik...@fb.com>
Authored: Tue Mar 15 14:40:52 2016 -0700
Committer: Igor Kabiljo <ik...@fb.com>
Committed: Fri Mar 18 16:49:45 2016 -0700
----------------------------------------------------------------------
.../org/apache/giraph/function/Consumer.java | 34 ----
.../org/apache/giraph/function/Function.java | 38 ----
.../apache/giraph/function/ObjectHolder.java | 56 ------
.../apache/giraph/function/ObjectTransfer.java | 113 -----------
.../apache/giraph/function/PairConsumer.java | 34 ----
.../apache/giraph/function/PairFunction.java | 40 ----
.../apache/giraph/function/PairPredicate.java | 35 ----
.../org/apache/giraph/function/Predicate.java | 36 ----
.../org/apache/giraph/function/Supplier.java | 37 ----
.../apache/giraph/function/TripleFunction.java | 41 ----
.../apache/giraph/function/package-info.java | 26 ---
.../function/primitive/Double2ObjFunction.java | 36 ----
.../function/primitive/DoubleConsumer.java | 32 ----
.../function/primitive/Int2ObjFunction.java | 36 ----
.../giraph/function/primitive/IntSupplier.java | 29 ---
.../function/primitive/Obj2DoubleFunction.java | 33 ----
.../function/primitive/Obj2FloatFunction.java | 33 ----
.../function/primitive/Obj2IntFunction.java | 33 ----
.../function/primitive/Obj2LongFunction.java | 33 ----
.../function/primitive/PrimitiveRefs.java | 107 -----------
.../giraph/function/primitive/package-info.java | 22 ---
.../function/vertex/ConsumerWithVertex.java | 48 -----
.../function/vertex/FunctionWithVertex.java | 52 ------
.../function/vertex/SupplierFromVertex.java | 49 -----
.../giraph/function/vertex/package-info.java | 22 ---
giraph-core/pom.xml | 7 +
.../org/apache/giraph/function/Consumer.java | 36 ++++
.../org/apache/giraph/function/Function.java | 41 ++++
.../apache/giraph/function/ObjectHolder.java | 62 +++++++
.../apache/giraph/function/ObjectTransfer.java | 129 +++++++++++++
.../apache/giraph/function/PairConsumer.java | 37 ++++
.../apache/giraph/function/PairFunction.java | 44 +++++
.../apache/giraph/function/PairPredicate.java | 39 ++++
.../org/apache/giraph/function/Predicate.java | 39 ++++
.../org/apache/giraph/function/Supplier.java | 39 ++++
.../apache/giraph/function/TripleFunction.java | 45 +++++
.../apache/giraph/function/package-info.java | 26 +++
.../function/primitive/BooleanConsumer.java | 36 ++++
.../giraph/function/primitive/ByteConsumer.java | 36 ++++
.../function/primitive/Double2ObjFunction.java | 39 ++++
.../function/primitive/DoubleConsumer.java | 36 ++++
.../function/primitive/FloatConsumer.java | 36 ++++
.../function/primitive/Int2ObjFunction.java | 39 ++++
.../giraph/function/primitive/IntConsumer.java | 36 ++++
.../giraph/function/primitive/IntSupplier.java | 33 ++++
.../giraph/function/primitive/LongConsumer.java | 36 ++++
.../function/primitive/Obj2BooleanFunction.java | 39 ++++
.../function/primitive/Obj2ByteFunction.java | 39 ++++
.../function/primitive/Obj2DoubleFunction.java | 39 ++++
.../function/primitive/Obj2FloatFunction.java | 39 ++++
.../function/primitive/Obj2IntFunction.java | 39 ++++
.../function/primitive/Obj2LongFunction.java | 39 ++++
.../function/primitive/PrimitiveRefs.java | 137 ++++++++++++++
.../giraph/function/primitive/package-info.java | 22 +++
.../function/vertex/ConsumerWithVertex.java | 51 +++++
.../function/vertex/FunctionWithVertex.java | 56 ++++++
.../function/vertex/SupplierFromVertex.java | 52 ++++++
.../giraph/function/vertex/package-info.java | 22 +++
.../generate/GeneratePrimitiveClasses.java | 185 +++++++++++++++++++
giraph-core/templates/Obj2TypeFunction.java | 38 ++++
giraph-core/templates/TypeConsumer.java | 35 ++++
61 files changed, 1703 insertions(+), 1055 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-block-app/src/main/java/org/apache/giraph/function/Consumer.java
----------------------------------------------------------------------
diff --git a/giraph-block-app/src/main/java/org/apache/giraph/function/Consumer.java b/giraph-block-app/src/main/java/org/apache/giraph/function/Consumer.java
deleted file mode 100644
index 2a0e36a..0000000
--- a/giraph-block-app/src/main/java/org/apache/giraph/function/Consumer.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.giraph.function;
-
-import java.io.Serializable;
-
-
-/**
- * Function:
- * (T) -> void
- *
- * @param <T> Argument type
- */
-public interface Consumer<T> extends Serializable {
- /**
- * Applies this function to {@code input}
- */
- void apply(T input);
-}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-block-app/src/main/java/org/apache/giraph/function/Function.java
----------------------------------------------------------------------
diff --git a/giraph-block-app/src/main/java/org/apache/giraph/function/Function.java b/giraph-block-app/src/main/java/org/apache/giraph/function/Function.java
deleted file mode 100644
index 41046ba..0000000
--- a/giraph-block-app/src/main/java/org/apache/giraph/function/Function.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.giraph.function;
-
-import java.io.Serializable;
-
-
-/**
- * Function:
- * (F) -> T
- *
- * @param <F> Argument type
- * @param <T> Result type
- */
-public interface Function<F, T> extends Serializable {
- /**
- * Returns the result of applying this function to given {@code input}.
- *
- * The returned object may or may not be a new instance,
- * depending on the implementation.
- */
- T apply(F input);
-}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-block-app/src/main/java/org/apache/giraph/function/ObjectHolder.java
----------------------------------------------------------------------
diff --git a/giraph-block-app/src/main/java/org/apache/giraph/function/ObjectHolder.java b/giraph-block-app/src/main/java/org/apache/giraph/function/ObjectHolder.java
deleted file mode 100644
index fd531bd..0000000
--- a/giraph-block-app/src/main/java/org/apache/giraph/function/ObjectHolder.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.giraph.function;
-
-/**
- * Default object holder, intermediary between producers and consumers.
- *
- * Holds value in memory, so can be used only when producer and consumer
- * are in the same context.
- *
- * Useful when value is set on the master, and later read in block logic
- * (RepeatUntilBlock), or in a different Piece, either on worker or master.
- * If it is read within the same piece - just use local field.
- *
- * @param <T> Type of object to hold.
- */
-public class ObjectHolder<T> implements Supplier<T>, Consumer<T> {
- private T value;
-
- public ObjectHolder(T value) {
- this.value = value;
- }
-
- public ObjectHolder() {
- }
-
- @Override
- public T get() {
- return value;
- }
-
- @Override
- public void apply(T value) {
- this.value = value;
- }
-
- @Override
- public String toString() {
- return getClass() + " [value=" + value + "]";
- }
-}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-block-app/src/main/java/org/apache/giraph/function/ObjectTransfer.java
----------------------------------------------------------------------
diff --git a/giraph-block-app/src/main/java/org/apache/giraph/function/ObjectTransfer.java b/giraph-block-app/src/main/java/org/apache/giraph/function/ObjectTransfer.java
deleted file mode 100644
index 8d72017..0000000
--- a/giraph-block-app/src/main/java/org/apache/giraph/function/ObjectTransfer.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * 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.giraph.function;
-
-import org.apache.giraph.function.vertex.ConsumerWithVertex;
-import org.apache.giraph.function.vertex.SupplierFromVertex;
-import org.apache.giraph.graph.Vertex;
-import org.apache.hadoop.io.Writable;
-import org.apache.hadoop.io.WritableComparable;
-
-/**
- * Default object transfer, intermediary between producers and consumers.
- *
- * Holds value temporarily in memory, so can be used only when producer and
- * consumer are in the same context. Nulls it out after supplying, so each
- * object is returned only once, and second consecutive call to 'get' will
- * return null.
- *
- * Useful for both:
- *
- * - passing data from vertexReceive function of WorkerReceivePiece of previous
- * Piece to vertexSend function WorkerSendPiece of next Piece, of the same
- * vertex.
- * - when value is set on the master, and later read in block logic
- * (RepeatUntilBlock), or in a different Piece, either on worker or master.
- * If it is read within the same piece - just use local field.
- *
- * @param <T> Type of object to transfer.
- */
-public class ObjectTransfer<T> implements Supplier<T>, Consumer<T> {
- private T value;
-
- public ObjectTransfer(T value) {
- this.value = value;
- }
-
- public ObjectTransfer() {
- }
-
- @Override
- public T get() {
- T result = value;
- value = null;
- return result;
- }
-
- @Override
- public void apply(T value) {
- this.value = value;
- }
-
- @Override
- public String toString() {
- return getClass() + " [value=" + value + "]";
- }
-
- /**
- * To be called when needing to pass it as a Supplier - making it
- * obvious that K, V and E on supplier side can be any types,
- * and to make code work without compile errors/warnings.
- *
- * In Java7, some callsites might need explicit types:
- * object.<LongWritable, DoubleWritable, Writable>castToSupplier()
- * In Java8, object.castToSupplier() is always going to be enough.
- */
- // TODO Java8: cleanup callers
- @SuppressWarnings("rawtypes")
- public <I extends WritableComparable, V extends Writable, E extends Writable>
- SupplierFromVertex<I, V, E, T> castToSupplier() {
- return new SupplierFromVertex<I, V, E, T>() {
- @Override
- public T get(Vertex<I, V, E> vertex) {
- return ObjectTransfer.this.get();
- }
- };
- }
-
- /**
- * To be called when needing to pass it as a Consumer - making it
- * obvious that K, V and E on consumer side can be any types,
- * and to make code work without compile errors/warnings.
- *
- * In Java7, some callsites might need explicit types:
- * object.<LongWritable, DoubleWritable, Writable>castToConsumer()
- * In Java8, object.castToConsumer() is always going to be enough.
- */
- // TODO Java8: cleanup callers
- @SuppressWarnings("rawtypes")
- public <I extends WritableComparable, V extends Writable, E extends Writable>
- ConsumerWithVertex<I, V, E, T> castToConsumer() {
- return new ConsumerWithVertex<I, V, E, T>() {
- @Override
- public void apply(Vertex<I, V, E> vertex, T value) {
- ObjectTransfer.this.apply(value);
- }
- };
- }
-}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-block-app/src/main/java/org/apache/giraph/function/PairConsumer.java
----------------------------------------------------------------------
diff --git a/giraph-block-app/src/main/java/org/apache/giraph/function/PairConsumer.java b/giraph-block-app/src/main/java/org/apache/giraph/function/PairConsumer.java
deleted file mode 100644
index 012ec82..0000000
--- a/giraph-block-app/src/main/java/org/apache/giraph/function/PairConsumer.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.giraph.function;
-
-import java.io.Serializable;
-
-/**
- * Function:
- * (T1, T2) -> void
- *
- * @param <T1> First argument type
- * @param <T2> Second argument type
- */
-public interface PairConsumer<T1, T2> extends Serializable {
- /**
- * Applies this function to {@code input1} and {@code input2}
- */
- void apply(T1 input1, T2 input2);
-}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-block-app/src/main/java/org/apache/giraph/function/PairFunction.java
----------------------------------------------------------------------
diff --git a/giraph-block-app/src/main/java/org/apache/giraph/function/PairFunction.java b/giraph-block-app/src/main/java/org/apache/giraph/function/PairFunction.java
deleted file mode 100644
index bfff400..0000000
--- a/giraph-block-app/src/main/java/org/apache/giraph/function/PairFunction.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.giraph.function;
-
-import java.io.Serializable;
-
-
-/**
- * Function:
- * (F1, F2) -> T
- *
- * @param <F1> First argument type
- * @param <F2> Second argument type
- * @param <T> Result type
- */
-public interface PairFunction<F1, F2, T> extends Serializable {
- /**
- * Returns the result of applying this function to given
- * {@code input1} and {@code input2}.
- *
- * The returned object may or may not be a new instance,
- * depending on the implementation.
- */
- T apply(F1 input1, F2 input2);
-}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-block-app/src/main/java/org/apache/giraph/function/PairPredicate.java
----------------------------------------------------------------------
diff --git a/giraph-block-app/src/main/java/org/apache/giraph/function/PairPredicate.java b/giraph-block-app/src/main/java/org/apache/giraph/function/PairPredicate.java
deleted file mode 100644
index 6d85e93..0000000
--- a/giraph-block-app/src/main/java/org/apache/giraph/function/PairPredicate.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.giraph.function;
-
-import java.io.Serializable;
-
-/**
- * Function:
- * (T) -> boolean
- *
- * @param <T1> First argument type
- * @param <T2> Second argument type
- */
-public interface PairPredicate<T1, T2> extends Serializable {
- /**
- * Returns the result of applying this predicate to
- * {@code input1} and {@code input2}.
- */
- boolean apply(T1 input1, T2 input2);
-}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-block-app/src/main/java/org/apache/giraph/function/Predicate.java
----------------------------------------------------------------------
diff --git a/giraph-block-app/src/main/java/org/apache/giraph/function/Predicate.java b/giraph-block-app/src/main/java/org/apache/giraph/function/Predicate.java
deleted file mode 100644
index c515ca0..0000000
--- a/giraph-block-app/src/main/java/org/apache/giraph/function/Predicate.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.giraph.function;
-
-import java.io.Serializable;
-
-/**
- * Function:
- * (T) -> boolean
- * <br>
- * Specialization of com.google.common.base.Predicate, that is also
- * Serializable.
- *
- * @param <T> Argument type
- */
-public interface Predicate<T> extends Serializable {
- /**
- * Returns the result of applying this predicate to {@code input}.
- */
- boolean apply(T input);
-}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-block-app/src/main/java/org/apache/giraph/function/Supplier.java
----------------------------------------------------------------------
diff --git a/giraph-block-app/src/main/java/org/apache/giraph/function/Supplier.java b/giraph-block-app/src/main/java/org/apache/giraph/function/Supplier.java
deleted file mode 100644
index 1813b54..0000000
--- a/giraph-block-app/src/main/java/org/apache/giraph/function/Supplier.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.giraph.function;
-
-import java.io.Serializable;
-
-/**
- * Function:
- * () -> T
- * <br>
- * Specialization of com.google.common.base.Supplier, that is also
- * Serializable.
- *
- * @param <T> Result type
- */
-public interface Supplier<T> extends Serializable {
- /**
- * Retrieves an instance of the appropriate type. The returned object may or
- * may not be a new instance, depending on the implementation.
- */
- T get();
-}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-block-app/src/main/java/org/apache/giraph/function/TripleFunction.java
----------------------------------------------------------------------
diff --git a/giraph-block-app/src/main/java/org/apache/giraph/function/TripleFunction.java b/giraph-block-app/src/main/java/org/apache/giraph/function/TripleFunction.java
deleted file mode 100644
index b7609ca..0000000
--- a/giraph-block-app/src/main/java/org/apache/giraph/function/TripleFunction.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.giraph.function;
-
-import java.io.Serializable;
-
-/**
- * Function:
- * (F1, F2, F3) -> T
- *
- * @param <F1> First argument type
- * @param <F2> Second argument type
- * @param <F3> Third argument type
- * @param <T> Result type
- */
-public interface TripleFunction<F1, F2, F3, T> extends Serializable {
-
- /**
- * Returns the result of applying this function to given
- * {@code input1}, {@code input2} and {@code input3}.
- *
- * The returned object may or may not be a new instance,
- * depending on the implementation.
- */
- T apply(F1 input1, F2 input2, F3 input3);
-}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-block-app/src/main/java/org/apache/giraph/function/package-info.java
----------------------------------------------------------------------
diff --git a/giraph-block-app/src/main/java/org/apache/giraph/function/package-info.java b/giraph-block-app/src/main/java/org/apache/giraph/function/package-info.java
deleted file mode 100644
index b089da6..0000000
--- a/giraph-block-app/src/main/java/org/apache/giraph/function/package-info.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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 for interfaces representing different functions,
- * that all extends Serializable in order for Kryo to be able
- * to serialize them.
- *
- * Even when same interface is present in Guava, we do not extend it
- * due to @Nullable annotations adding requirement of handling nulls.
- */
-package org.apache.giraph.function;
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/Double2ObjFunction.java
----------------------------------------------------------------------
diff --git a/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/Double2ObjFunction.java b/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/Double2ObjFunction.java
deleted file mode 100644
index 8b3c0a3..0000000
--- a/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/Double2ObjFunction.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.giraph.function.primitive;
-
-import java.io.Serializable;
-
-/**
- * Primitive specialization of Function:
- * (double) -> T
- *
- * @param <T> Result type
- */
-public interface Double2ObjFunction<T> extends Serializable {
- /**
- * Returns the result of applying this function to given {@code input}.
- *
- * The returned object may or may not be a new instance,
- * depending on the implementation.
- */
- T apply(double input);
-}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/DoubleConsumer.java
----------------------------------------------------------------------
diff --git a/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/DoubleConsumer.java b/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/DoubleConsumer.java
deleted file mode 100644
index 4725d4b..0000000
--- a/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/DoubleConsumer.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.giraph.function.primitive;
-
-import java.io.Serializable;
-
-
-/**
- * Primitive specialization of Function:
- * (double) -> void
- */
-public interface DoubleConsumer extends Serializable {
- /**
- * Applies this function to {@code input}
- */
- void apply(double input);
-}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/Int2ObjFunction.java
----------------------------------------------------------------------
diff --git a/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/Int2ObjFunction.java b/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/Int2ObjFunction.java
deleted file mode 100644
index d082072..0000000
--- a/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/Int2ObjFunction.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.giraph.function.primitive;
-
-import java.io.Serializable;
-
-/**
- * Primitive specialization of Function:
- * (int) -> T
- *
- * @param <T> Result type
- */
-public interface Int2ObjFunction<T> extends Serializable {
- /**
- * Returns the result of applying this function to given {@code input}.
- *
- * The returned object may or may not be a new instance,
- * depending on the implementation.
- */
- T apply(int input);
-}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/IntSupplier.java
----------------------------------------------------------------------
diff --git a/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/IntSupplier.java b/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/IntSupplier.java
deleted file mode 100644
index d709895..0000000
--- a/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/IntSupplier.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.giraph.function.primitive;
-
-import java.io.Serializable;
-
-/**
- * Primitive specialization of Function:
- * () -> int
- */
-public interface IntSupplier extends Serializable {
- /** Retrieves an int value. */
- int get();
-}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/Obj2DoubleFunction.java
----------------------------------------------------------------------
diff --git a/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/Obj2DoubleFunction.java b/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/Obj2DoubleFunction.java
deleted file mode 100644
index ad1ca8e..0000000
--- a/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/Obj2DoubleFunction.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.giraph.function.primitive;
-
-import java.io.Serializable;
-
-/**
- * Primitive specialization of Function:
- * (F) -> double
- *
- * @param <T> Argument type
- */
-public interface Obj2DoubleFunction<T> extends Serializable {
- /**
- * Returns the result of applying this function to given {@code input}.
- */
- double apply(T value);
-}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/Obj2FloatFunction.java
----------------------------------------------------------------------
diff --git a/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/Obj2FloatFunction.java b/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/Obj2FloatFunction.java
deleted file mode 100644
index b1a653f..0000000
--- a/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/Obj2FloatFunction.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.giraph.function.primitive;
-
-import java.io.Serializable;
-
-/**
- * Primitive specialization of Function:
- * (F) -> float
- *
- * @param <T> Argument type
- */
-public interface Obj2FloatFunction<T> extends Serializable {
- /**
- * Returns the result of applying this function to given {@code input}.
- */
- float apply(T input);
-}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/Obj2IntFunction.java
----------------------------------------------------------------------
diff --git a/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/Obj2IntFunction.java b/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/Obj2IntFunction.java
deleted file mode 100644
index 6d3d739..0000000
--- a/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/Obj2IntFunction.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.giraph.function.primitive;
-
-import java.io.Serializable;
-
-/**
- * Primitive specialization of Function:
- * (F) -> int
- *
- * @param <T> Argument type
- */
-public interface Obj2IntFunction<T> extends Serializable {
- /**
- * Returns the result of applying this function to given {@code input}.
- */
- int apply(T input);
-}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/Obj2LongFunction.java
----------------------------------------------------------------------
diff --git a/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/Obj2LongFunction.java b/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/Obj2LongFunction.java
deleted file mode 100644
index 5300250..0000000
--- a/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/Obj2LongFunction.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.giraph.function.primitive;
-
-import java.io.Serializable;
-
-/**
- * Primitive specialization of Function:
- * (F) -> long
- *
- * @param <T> Argument type
- */
-public interface Obj2LongFunction<T> extends Serializable {
- /**
- * Returns the result of applying this function to given {@code input}.
- */
- long apply(T input);
-}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/PrimitiveRefs.java
----------------------------------------------------------------------
diff --git a/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/PrimitiveRefs.java b/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/PrimitiveRefs.java
deleted file mode 100644
index 9a9f742..0000000
--- a/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/PrimitiveRefs.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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.giraph.function.primitive;
-
-/**
- * Convenience classes holding primitive values - a reference
- * to a mutable value.
- * For use when lambdas need to mutate capturing primitive local variable.
- * (since lambdas cannot capture and modify local variables)
- */
-public interface PrimitiveRefs {
-
- // Have public field for convenience, since classes have no logic inside
- // CHECKSTYLE: stop VisibilityModifierCheck
-
- /**
- * Convenience class holding int value,
- * for use when lambdas need to mutate capturing int local variable.
- */
- public class IntRef {
- public int value;
-
- public IntRef(int value) {
- this.value = value;
- }
- }
-
- /**
- * Convenience class holding long value,
- * for use when lambdas need to mutate capturing long local variable.
- */
- public class LongRef {
- public long value;
-
- public LongRef(long value) {
- this.value = value;
- }
- }
-
- /**
- * Convenience class holding int value,
- * for use when lambdas need to mutate capturing int local variable.
- */
- public class ShortRef {
- public short value;
-
- public ShortRef(short value) {
- this.value = value;
- }
- }
-
-
- /**
- * Convenience class holding float value,
- * for use when lambdas need to mutate capturing float local variable.
- */
- public class FloatRef {
- public float value;
-
- public FloatRef(float value) {
- this.value = value;
- }
- }
-
- /**
- * Convenience class holding double value,
- * for use when lambdas need to mutate capturing double local variable.
- */
- public class DoubleRef {
- public double value;
-
- public DoubleRef(double value) {
- this.value = value;
- }
- }
-
- /**
- * Convenience class holding object values,
- * for use when lambdas need to mutate capturing object local variable.
- *
- * <O> object
- */
- public class ObjRef<O> {
- public O value;
-
- public ObjRef(O value) {
- this.value = value;
- }
- }
-
- // CHECKSTYLE: resume VisibilityModifierCheck
-}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/package-info.java
----------------------------------------------------------------------
diff --git a/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/package-info.java b/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/package-info.java
deleted file mode 100644
index fdf40ff..0000000
--- a/giraph-block-app/src/main/java/org/apache/giraph/function/primitive/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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.
- */
-/**
- * Primitive specializations of interfaces from org.apache.giraph.function
- * package.
- */
-package org.apache.giraph.function.primitive;
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-block-app/src/main/java/org/apache/giraph/function/vertex/ConsumerWithVertex.java
----------------------------------------------------------------------
diff --git a/giraph-block-app/src/main/java/org/apache/giraph/function/vertex/ConsumerWithVertex.java b/giraph-block-app/src/main/java/org/apache/giraph/function/vertex/ConsumerWithVertex.java
deleted file mode 100644
index 87e7f9b..0000000
--- a/giraph-block-app/src/main/java/org/apache/giraph/function/vertex/ConsumerWithVertex.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.giraph.function.vertex;
-
-import java.io.Serializable;
-
-import org.apache.giraph.function.PairConsumer;
-import org.apache.giraph.graph.Vertex;
-import org.apache.hadoop.io.Writable;
-import org.apache.hadoop.io.WritableComparable;
-
-
-/**
- * Function:
- * (vertex, T) -> void
- *
- * A class that can consume objects of a single type, when given a vertex.
- *
- * @param <I> Vertex id type
- * @param <V> Vertex value type
- * @param <E> Edge value type
- * @param <T> Argument type
- */
-@SuppressWarnings("rawtypes")
-public interface ConsumerWithVertex<I extends WritableComparable,
- V extends Writable, E extends Writable, T>
- extends PairConsumer<Vertex<I, V, E>, T>, Serializable {
- /**
- * Applies this function to {@code vertex} and {@code input}
- */
- @Override
- void apply(Vertex<I, V, E> vertex, T value);
-}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-block-app/src/main/java/org/apache/giraph/function/vertex/FunctionWithVertex.java
----------------------------------------------------------------------
diff --git a/giraph-block-app/src/main/java/org/apache/giraph/function/vertex/FunctionWithVertex.java b/giraph-block-app/src/main/java/org/apache/giraph/function/vertex/FunctionWithVertex.java
deleted file mode 100644
index fdab5de..0000000
--- a/giraph-block-app/src/main/java/org/apache/giraph/function/vertex/FunctionWithVertex.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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.giraph.function.vertex;
-
-import java.io.Serializable;
-
-import org.apache.giraph.function.PairFunction;
-import org.apache.giraph.graph.Vertex;
-import org.apache.hadoop.io.Writable;
-import org.apache.hadoop.io.WritableComparable;
-
-/**
- * Function:
- * (vertex, F) -> T
- *
- * Determines an output value based on a vertex and an input value.
- *
- * @param <I> Vertex id type
- * @param <V> Vertex value type
- * @param <E> Edge value type
- * @param <F> Argument type
- * @param <T> Result type
- */
-@SuppressWarnings("rawtypes")
-public interface FunctionWithVertex<I extends WritableComparable,
- V extends Writable, E extends Writable, F, T>
- extends PairFunction<Vertex<I, V, E>, F, T>, Serializable {
- /**
- * Returns the result of applying this function to given
- * {@code vertex} and {@code input}.
- *
- * The returned object may or may not be a new instance,
- * depending on the implementation.
- */
- @Override
- T apply(Vertex<I, V, E> vertex, F input);
-}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-block-app/src/main/java/org/apache/giraph/function/vertex/SupplierFromVertex.java
----------------------------------------------------------------------
diff --git a/giraph-block-app/src/main/java/org/apache/giraph/function/vertex/SupplierFromVertex.java b/giraph-block-app/src/main/java/org/apache/giraph/function/vertex/SupplierFromVertex.java
deleted file mode 100644
index bc0f9c1..0000000
--- a/giraph-block-app/src/main/java/org/apache/giraph/function/vertex/SupplierFromVertex.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.giraph.function.vertex;
-
-import java.io.Serializable;
-
-import org.apache.giraph.graph.Vertex;
-import org.apache.hadoop.io.Writable;
-import org.apache.hadoop.io.WritableComparable;
-
-/**
- * Function:
- * (vertex) -> T
- *
- * A class that can supply objects of a single type, when given a vertex.
- *
- * (doesn't extend Function<Vertex<I, V, E>, T>, because of different
- * method names)
- *
- * @param <I> Vertex id type
- * @param <V> Vertex value type
- * @param <E> Edge value type
- * @param <T> Result type
- */
-@SuppressWarnings("rawtypes")
-public interface SupplierFromVertex<I extends WritableComparable,
- V extends Writable, E extends Writable, T> extends Serializable {
- /**
- * Retrieves an instance of the appropriate type, given a vertex.
- * The returned object may or may not be a new instance,
- * depending on the implementation.
- */
- T get(Vertex<I, V, E> vertex);
-}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-block-app/src/main/java/org/apache/giraph/function/vertex/package-info.java
----------------------------------------------------------------------
diff --git a/giraph-block-app/src/main/java/org/apache/giraph/function/vertex/package-info.java b/giraph-block-app/src/main/java/org/apache/giraph/function/vertex/package-info.java
deleted file mode 100644
index bd5b019..0000000
--- a/giraph-block-app/src/main/java/org/apache/giraph/function/vertex/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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 for interfaces representing functions additionally
- * performed on vertex values.
- */
-package org.apache.giraph.function.vertex;
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-core/pom.xml
----------------------------------------------------------------------
diff --git a/giraph-core/pom.xml b/giraph-core/pom.xml
index e98741e..ddf3cd1 100644
--- a/giraph-core/pom.xml
+++ b/giraph-core/pom.xml
@@ -578,5 +578,12 @@ under the License.
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.freemarker</groupId>
+ <artifactId>freemarker</artifactId>
+ <version>2.3.23</version>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-core/src/main/java/org/apache/giraph/function/Consumer.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/function/Consumer.java b/giraph-core/src/main/java/org/apache/giraph/function/Consumer.java
new file mode 100644
index 0000000..b5d49ab
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/function/Consumer.java
@@ -0,0 +1,36 @@
+/*
+ * 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.giraph.function;
+
+import java.io.Serializable;
+
+
+/**
+ * Function:
+ * (T) -> void
+ *
+ * @param <T> Argument type
+ */
+public interface Consumer<T> extends Serializable {
+ /**
+ * Applies this function to {@code input}
+ *
+ * @param input Input
+ */
+ void apply(T input);
+}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-core/src/main/java/org/apache/giraph/function/Function.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/function/Function.java b/giraph-core/src/main/java/org/apache/giraph/function/Function.java
new file mode 100644
index 0000000..3354fda
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/function/Function.java
@@ -0,0 +1,41 @@
+/*
+ * 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.giraph.function;
+
+import java.io.Serializable;
+
+
+/**
+ * Function:
+ * (F) -> T
+ *
+ * @param <F> Argument type
+ * @param <T> Result type
+ */
+public interface Function<F, T> extends Serializable {
+ /**
+ * Returns the result of applying this function to given {@code input}.
+ *
+ * The returned object may or may not be a new instance,
+ * depending on the implementation.
+ *
+ * @param input Input
+ * @return result
+ */
+ T apply(F input);
+}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-core/src/main/java/org/apache/giraph/function/ObjectHolder.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/function/ObjectHolder.java b/giraph-core/src/main/java/org/apache/giraph/function/ObjectHolder.java
new file mode 100644
index 0000000..ffbe78d
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/function/ObjectHolder.java
@@ -0,0 +1,62 @@
+/*
+ * 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.giraph.function;
+
+/**
+ * Default object holder, intermediary between producers and consumers.
+ *
+ * Holds value in memory, so can be used only when producer and consumer
+ * are in the same context.
+ *
+ * Useful when value is set on the master, and later read in block logic
+ * (RepeatUntilBlock), or in a different Piece, either on worker or master.
+ * If it is read within the same piece - just use local field.
+ *
+ * @param <T> Type of object to hold.
+ */
+public class ObjectHolder<T> implements Supplier<T>, Consumer<T> {
+ /** value */
+ private T value;
+
+ /**
+ * Constructor
+ * @param value initial value
+ */
+ public ObjectHolder(T value) {
+ this.value = value;
+ }
+
+ /** Constructor */
+ public ObjectHolder() {
+ }
+
+ @Override
+ public T get() {
+ return value;
+ }
+
+ @Override
+ public void apply(T value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return getClass() + " [value=" + value + "]";
+ }
+}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-core/src/main/java/org/apache/giraph/function/ObjectTransfer.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/function/ObjectTransfer.java b/giraph-core/src/main/java/org/apache/giraph/function/ObjectTransfer.java
new file mode 100644
index 0000000..a67dd12
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/function/ObjectTransfer.java
@@ -0,0 +1,129 @@
+/*
+ * 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.giraph.function;
+
+import org.apache.giraph.function.vertex.ConsumerWithVertex;
+import org.apache.giraph.function.vertex.SupplierFromVertex;
+import org.apache.giraph.graph.Vertex;
+import org.apache.hadoop.io.Writable;
+import org.apache.hadoop.io.WritableComparable;
+
+/**
+ * Default object transfer, intermediary between producers and consumers.
+ *
+ * Holds value temporarily in memory, so can be used only when producer and
+ * consumer are in the same context. Nulls it out after supplying, so each
+ * object is returned only once, and second consecutive call to 'get' will
+ * return null.
+ *
+ * Useful for both:
+ *
+ * - passing data from vertexReceive function of WorkerReceivePiece of previous
+ * Piece to vertexSend function WorkerSendPiece of next Piece, of the same
+ * vertex.
+ * - when value is set on the master, and later read in block logic
+ * (RepeatUntilBlock), or in a different Piece, either on worker or master.
+ * If it is read within the same piece - just use local field.
+ *
+ * @param <T> Type of object to transfer.
+ */
+public class ObjectTransfer<T> implements Supplier<T>, Consumer<T> {
+ /** value */
+ private T value;
+
+ /**
+ * Constructor
+ * @param value initial value
+ */
+ public ObjectTransfer(T value) {
+ this.value = value;
+ }
+
+ /** Constructor */
+ public ObjectTransfer() {
+ }
+
+ @Override
+ public T get() {
+ T result = value;
+ value = null;
+ return result;
+ }
+
+ @Override
+ public void apply(T value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return getClass() + " [value=" + value + "]";
+ }
+
+ /**
+ * To be called when needing to pass it as a Supplier - making it
+ * obvious that K, V and E on supplier side can be any types,
+ * and to make code work without compile errors/warnings.
+ *
+ * In Java7, some callsites might need explicit types:
+ * object.<LongWritable, DoubleWritable, Writable>castToSupplier()
+ * In Java8, object.castToSupplier() is always going to be enough.
+ *
+ * @param <I> Vertex id type
+ * @param <V> Vertex value type
+ * @param <E> Edge value type
+ * @return supplier from vertex
+ */
+ // TODO Java8: cleanup callers
+ @SuppressWarnings("rawtypes")
+ public <I extends WritableComparable, V extends Writable, E extends Writable>
+ SupplierFromVertex<I, V, E, T> castToSupplier() {
+ return new SupplierFromVertex<I, V, E, T>() {
+ @Override
+ public T get(Vertex<I, V, E> vertex) {
+ return ObjectTransfer.this.get();
+ }
+ };
+ }
+
+ /**
+ * To be called when needing to pass it as a Consumer - making it
+ * obvious that K, V and E on consumer side can be any types,
+ * and to make code work without compile errors/warnings.
+ *
+ * In Java7, some callsites might need explicit types:
+ * object.<LongWritable, DoubleWritable, Writable>castToConsumer()
+ * In Java8, object.castToConsumer() is always going to be enough.
+ *
+ * @param <I> Vertex id type
+ * @param <V> Vertex value type
+ * @param <E> Edge value type
+ * @return consumer with vertex
+ */
+ // TODO Java8: cleanup callers
+ @SuppressWarnings("rawtypes")
+ public <I extends WritableComparable, V extends Writable, E extends Writable>
+ ConsumerWithVertex<I, V, E, T> castToConsumer() {
+ return new ConsumerWithVertex<I, V, E, T>() {
+ @Override
+ public void apply(Vertex<I, V, E> vertex, T value) {
+ ObjectTransfer.this.apply(value);
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-core/src/main/java/org/apache/giraph/function/PairConsumer.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/function/PairConsumer.java b/giraph-core/src/main/java/org/apache/giraph/function/PairConsumer.java
new file mode 100644
index 0000000..b1c633f
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/function/PairConsumer.java
@@ -0,0 +1,37 @@
+/*
+ * 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.giraph.function;
+
+import java.io.Serializable;
+
+/**
+ * Function:
+ * (T1, T2) -> void
+ *
+ * @param <T1> First argument type
+ * @param <T2> Second argument type
+ */
+public interface PairConsumer<T1, T2> extends Serializable {
+ /**
+ * Applies this function to {@code input1} and {@code input2}
+ *
+ * @param input1 first input
+ * @param input2 second input
+ */
+ void apply(T1 input1, T2 input2);
+}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-core/src/main/java/org/apache/giraph/function/PairFunction.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/function/PairFunction.java b/giraph-core/src/main/java/org/apache/giraph/function/PairFunction.java
new file mode 100644
index 0000000..49ee3bf
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/function/PairFunction.java
@@ -0,0 +1,44 @@
+/*
+ * 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.giraph.function;
+
+import java.io.Serializable;
+
+
+/**
+ * Function:
+ * (F1, F2) -> T
+ *
+ * @param <F1> First argument type
+ * @param <F2> Second argument type
+ * @param <T> Result type
+ */
+public interface PairFunction<F1, F2, T> extends Serializable {
+ /**
+ * Returns the result of applying this function to given
+ * {@code input1} and {@code input2}.
+ *
+ * The returned object may or may not be a new instance,
+ * depending on the implementation.
+ *
+ * @param input1 first input
+ * @param input2 second input
+ * @return result
+ */
+ T apply(F1 input1, F2 input2);
+}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-core/src/main/java/org/apache/giraph/function/PairPredicate.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/function/PairPredicate.java b/giraph-core/src/main/java/org/apache/giraph/function/PairPredicate.java
new file mode 100644
index 0000000..5203ef7
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/function/PairPredicate.java
@@ -0,0 +1,39 @@
+/*
+ * 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.giraph.function;
+
+import java.io.Serializable;
+
+/**
+ * Function:
+ * (T) -> boolean
+ *
+ * @param <T1> First argument type
+ * @param <T2> Second argument type
+ */
+public interface PairPredicate<T1, T2> extends Serializable {
+ /**
+ * Returns the result of applying this predicate to
+ * {@code input1} and {@code input2}.
+ *
+ * @param input1 first input
+ * @param input2 second input
+ * @return result
+ */
+ boolean apply(T1 input1, T2 input2);
+}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-core/src/main/java/org/apache/giraph/function/Predicate.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/function/Predicate.java b/giraph-core/src/main/java/org/apache/giraph/function/Predicate.java
new file mode 100644
index 0000000..0e4e3fd
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/function/Predicate.java
@@ -0,0 +1,39 @@
+/*
+ * 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.giraph.function;
+
+import java.io.Serializable;
+
+/**
+ * Function:
+ * (T) -> boolean
+ * <br>
+ * Specialization of com.google.common.base.Predicate, that is also
+ * Serializable.
+ *
+ * @param <T> Argument type
+ */
+public interface Predicate<T> extends Serializable {
+ /**
+ * Returns the result of applying this predicate to {@code input}.
+ *
+ * @param input input
+ * @return result
+ */
+ boolean apply(T input);
+}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-core/src/main/java/org/apache/giraph/function/Supplier.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/function/Supplier.java b/giraph-core/src/main/java/org/apache/giraph/function/Supplier.java
new file mode 100644
index 0000000..ce746d0
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/function/Supplier.java
@@ -0,0 +1,39 @@
+/*
+ * 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.giraph.function;
+
+import java.io.Serializable;
+
+/**
+ * Function:
+ * () -> T
+ * <br>
+ * Specialization of com.google.common.base.Supplier, that is also
+ * Serializable.
+ *
+ * @param <T> Result type
+ */
+public interface Supplier<T> extends Serializable {
+ /**
+ * Retrieves an instance of the appropriate type. The returned object may or
+ * may not be a new instance, depending on the implementation.
+ *
+ * @return result
+ */
+ T get();
+}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-core/src/main/java/org/apache/giraph/function/TripleFunction.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/function/TripleFunction.java b/giraph-core/src/main/java/org/apache/giraph/function/TripleFunction.java
new file mode 100644
index 0000000..0c6a73c
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/function/TripleFunction.java
@@ -0,0 +1,45 @@
+/*
+ * 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.giraph.function;
+
+import java.io.Serializable;
+
+/**
+ * Function:
+ * (F1, F2, F3) -> T
+ *
+ * @param <F1> First argument type
+ * @param <F2> Second argument type
+ * @param <F3> Third argument type
+ * @param <T> Result type
+ */
+public interface TripleFunction<F1, F2, F3, T> extends Serializable {
+ /**
+ * Returns the result of applying this function to given
+ * {@code input1}, {@code input2} and {@code input3}.
+ *
+ * The returned object may or may not be a new instance,
+ * depending on the implementation.
+ *
+ * @param input1 first input
+ * @param input2 second input
+ * @param input3 third input
+ * @return result
+ */
+ T apply(F1 input1, F2 input2, F3 input3);
+}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-core/src/main/java/org/apache/giraph/function/package-info.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/function/package-info.java b/giraph-core/src/main/java/org/apache/giraph/function/package-info.java
new file mode 100644
index 0000000..b089da6
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/function/package-info.java
@@ -0,0 +1,26 @@
+/*
+ * 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 for interfaces representing different functions,
+ * that all extends Serializable in order for Kryo to be able
+ * to serialize them.
+ *
+ * Even when same interface is present in Guava, we do not extend it
+ * due to @Nullable annotations adding requirement of handling nulls.
+ */
+package org.apache.giraph.function;
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-core/src/main/java/org/apache/giraph/function/primitive/BooleanConsumer.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/function/primitive/BooleanConsumer.java b/giraph-core/src/main/java/org/apache/giraph/function/primitive/BooleanConsumer.java
new file mode 100644
index 0000000..a3e7991
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/function/primitive/BooleanConsumer.java
@@ -0,0 +1,36 @@
+/*
+ * 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.giraph.function.primitive;
+
+import java.io.Serializable;
+
+// AUTO-GENERATED class via class:
+// org.apache.giraph.generate.GeneratePrimitiveClasses
+
+/**
+ * Primitive specialization of Function:
+ * (boolean) -> void
+ */
+public interface BooleanConsumer extends Serializable {
+ /**
+ * Applies this function to {@code input}
+ *
+ * @param input input
+ */
+ void apply(boolean input);
+}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-core/src/main/java/org/apache/giraph/function/primitive/ByteConsumer.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/function/primitive/ByteConsumer.java b/giraph-core/src/main/java/org/apache/giraph/function/primitive/ByteConsumer.java
new file mode 100644
index 0000000..a936be8
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/function/primitive/ByteConsumer.java
@@ -0,0 +1,36 @@
+/*
+ * 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.giraph.function.primitive;
+
+import java.io.Serializable;
+
+// AUTO-GENERATED class via class:
+// org.apache.giraph.generate.GeneratePrimitiveClasses
+
+/**
+ * Primitive specialization of Function:
+ * (byte) -> void
+ */
+public interface ByteConsumer extends Serializable {
+ /**
+ * Applies this function to {@code input}
+ *
+ * @param input input
+ */
+ void apply(byte input);
+}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-core/src/main/java/org/apache/giraph/function/primitive/Double2ObjFunction.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/function/primitive/Double2ObjFunction.java b/giraph-core/src/main/java/org/apache/giraph/function/primitive/Double2ObjFunction.java
new file mode 100644
index 0000000..3feca25
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/function/primitive/Double2ObjFunction.java
@@ -0,0 +1,39 @@
+/*
+ * 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.giraph.function.primitive;
+
+import java.io.Serializable;
+
+/**
+ * Primitive specialization of Function:
+ * (double) -> T
+ *
+ * @param <T> Result type
+ */
+public interface Double2ObjFunction<T> extends Serializable {
+ /**
+ * Returns the result of applying this function to given {@code input}.
+ *
+ * The returned object may or may not be a new instance,
+ * depending on the implementation.
+ *
+ * @param input input
+ * @return result
+ */
+ T apply(double input);
+}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-core/src/main/java/org/apache/giraph/function/primitive/DoubleConsumer.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/function/primitive/DoubleConsumer.java b/giraph-core/src/main/java/org/apache/giraph/function/primitive/DoubleConsumer.java
new file mode 100644
index 0000000..f34e595
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/function/primitive/DoubleConsumer.java
@@ -0,0 +1,36 @@
+/*
+ * 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.giraph.function.primitive;
+
+import java.io.Serializable;
+
+// AUTO-GENERATED class via class:
+// org.apache.giraph.generate.GeneratePrimitiveClasses
+
+/**
+ * Primitive specialization of Function:
+ * (double) -> void
+ */
+public interface DoubleConsumer extends Serializable {
+ /**
+ * Applies this function to {@code input}
+ *
+ * @param input input
+ */
+ void apply(double input);
+}
http://git-wip-us.apache.org/repos/asf/giraph/blob/a927450a/giraph-core/src/main/java/org/apache/giraph/function/primitive/FloatConsumer.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/function/primitive/FloatConsumer.java b/giraph-core/src/main/java/org/apache/giraph/function/primitive/FloatConsumer.java
new file mode 100644
index 0000000..db2999e
--- /dev/null
+++ b/giraph-core/src/main/java/org/apache/giraph/function/primitive/FloatConsumer.java
@@ -0,0 +1,36 @@
+/*
+ * 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.giraph.function.primitive;
+
+import java.io.Serializable;
+
+// AUTO-GENERATED class via class:
+// org.apache.giraph.generate.GeneratePrimitiveClasses
+
+/**
+ * Primitive specialization of Function:
+ * (float) -> void
+ */
+public interface FloatConsumer extends Serializable {
+ /**
+ * Applies this function to {@code input}
+ *
+ * @param input input
+ */
+ void apply(float input);
+}