Updated Branches: refs/heads/trunk 81b837d36 -> e1352c8e4
GIRAPH-610: Simplify implementation of configurable VertexEdges (apresta) Project: http://git-wip-us.apache.org/repos/asf/giraph/repo Commit: http://git-wip-us.apache.org/repos/asf/giraph/commit/e1352c8e Tree: http://git-wip-us.apache.org/repos/asf/giraph/tree/e1352c8e Diff: http://git-wip-us.apache.org/repos/asf/giraph/diff/e1352c8e Branch: refs/heads/trunk Commit: e1352c8e4e48444e6dc6a3bed5c99975c396dc86 Parents: 81b837d Author: Alessandro Presta <[email protected]> Authored: Mon Apr 8 14:33:55 2013 -0700 Committer: Alessandro Presta <[email protected]> Committed: Mon Apr 8 14:33:55 2013 -0700 ---------------------------------------------------------------------- .../org/apache/giraph/edge/ArrayListEdges.java | 3 +- .../org/apache/giraph/edge/ByteArrayEdges.java | 3 +- .../giraph/edge/ConfigurableVertexEdges.java | 36 +++++++++++++++ .../java/org/apache/giraph/edge/HashMapEdges.java | 3 +- .../org/apache/giraph/edge/HashMultimapEdges.java | 3 +- 5 files changed, 40 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/giraph/blob/e1352c8e/giraph-core/src/main/java/org/apache/giraph/edge/ArrayListEdges.java ---------------------------------------------------------------------- diff --git a/giraph-core/src/main/java/org/apache/giraph/edge/ArrayListEdges.java b/giraph-core/src/main/java/org/apache/giraph/edge/ArrayListEdges.java index b6307f1..dda7568 100644 --- a/giraph-core/src/main/java/org/apache/giraph/edge/ArrayListEdges.java +++ b/giraph-core/src/main/java/org/apache/giraph/edge/ArrayListEdges.java @@ -19,7 +19,6 @@ package org.apache.giraph.edge; import com.google.common.collect.Lists; -import org.apache.giraph.conf.DefaultImmutableClassesGiraphConfigurable; import org.apache.giraph.utils.WritableUtils; import org.apache.hadoop.io.Writable; import org.apache.hadoop.io.WritableComparable; @@ -38,7 +37,7 @@ import java.util.Iterator; * @param <E> Edge value */ public class ArrayListEdges<I extends WritableComparable, E extends Writable> - extends DefaultImmutableClassesGiraphConfigurable<I, Writable, E, Writable> + extends ConfigurableVertexEdges<I, E> implements MutableVertexEdges<I, E> { /** List of edges. */ private ArrayList<Edge<I, E>> edgeList; http://git-wip-us.apache.org/repos/asf/giraph/blob/e1352c8e/giraph-core/src/main/java/org/apache/giraph/edge/ByteArrayEdges.java ---------------------------------------------------------------------- diff --git a/giraph-core/src/main/java/org/apache/giraph/edge/ByteArrayEdges.java b/giraph-core/src/main/java/org/apache/giraph/edge/ByteArrayEdges.java index 7d38b6e..16748ef 100644 --- a/giraph-core/src/main/java/org/apache/giraph/edge/ByteArrayEdges.java +++ b/giraph-core/src/main/java/org/apache/giraph/edge/ByteArrayEdges.java @@ -19,7 +19,6 @@ package org.apache.giraph.edge; import com.google.common.collect.UnmodifiableIterator; -import org.apache.giraph.conf.DefaultImmutableClassesGiraphConfigurable; import org.apache.giraph.utils.ExtendedDataInput; import org.apache.giraph.utils.ExtendedDataOutput; import org.apache.giraph.utils.WritableUtils; @@ -43,7 +42,7 @@ import java.util.List; * @param <E> Edge value */ public class ByteArrayEdges<I extends WritableComparable, E extends Writable> - extends DefaultImmutableClassesGiraphConfigurable<I, Writable, E, Writable> + extends ConfigurableVertexEdges<I, E> implements ReuseObjectsVertexEdges<I, E> { /** Serialized edges. */ private byte[] serializedEdges; http://git-wip-us.apache.org/repos/asf/giraph/blob/e1352c8e/giraph-core/src/main/java/org/apache/giraph/edge/ConfigurableVertexEdges.java ---------------------------------------------------------------------- diff --git a/giraph-core/src/main/java/org/apache/giraph/edge/ConfigurableVertexEdges.java b/giraph-core/src/main/java/org/apache/giraph/edge/ConfigurableVertexEdges.java new file mode 100644 index 0000000..f05e0d7 --- /dev/null +++ b/giraph-core/src/main/java/org/apache/giraph/edge/ConfigurableVertexEdges.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.edge; + +import org.apache.giraph.conf.DefaultImmutableClassesGiraphConfigurable; +import org.apache.hadoop.io.Writable; +import org.apache.hadoop.io.WritableComparable; + +/** + * Common base class for {@link VertexEdges} implementations that require a + * configuration. + * + * @param <I> Vertex id + * @param <E> Edge value + */ +public abstract class ConfigurableVertexEdges<I extends WritableComparable, + E extends Writable> + extends DefaultImmutableClassesGiraphConfigurable<I, Writable, E, + Writable> implements VertexEdges<I, E> { +} http://git-wip-us.apache.org/repos/asf/giraph/blob/e1352c8e/giraph-core/src/main/java/org/apache/giraph/edge/HashMapEdges.java ---------------------------------------------------------------------- diff --git a/giraph-core/src/main/java/org/apache/giraph/edge/HashMapEdges.java b/giraph-core/src/main/java/org/apache/giraph/edge/HashMapEdges.java index f3d6046..9fa7b64 100644 --- a/giraph-core/src/main/java/org/apache/giraph/edge/HashMapEdges.java +++ b/giraph-core/src/main/java/org/apache/giraph/edge/HashMapEdges.java @@ -19,7 +19,6 @@ package org.apache.giraph.edge; import com.google.common.collect.Maps; -import org.apache.giraph.conf.DefaultImmutableClassesGiraphConfigurable; import org.apache.hadoop.io.Writable; import org.apache.hadoop.io.WritableComparable; @@ -41,7 +40,7 @@ import java.util.Map; * @param <E> Edge value */ public class HashMapEdges<I extends WritableComparable, E extends Writable> - extends DefaultImmutableClassesGiraphConfigurable<I, Writable, E, Writable> + extends ConfigurableVertexEdges<I, E> implements StrictRandomAccessVertexEdges<I, E>, MutableVertexEdges<I, E> { /** Map from target vertex id to edge value. */ http://git-wip-us.apache.org/repos/asf/giraph/blob/e1352c8e/giraph-core/src/main/java/org/apache/giraph/edge/HashMultimapEdges.java ---------------------------------------------------------------------- diff --git a/giraph-core/src/main/java/org/apache/giraph/edge/HashMultimapEdges.java b/giraph-core/src/main/java/org/apache/giraph/edge/HashMultimapEdges.java index 8bbfdc1..123d49f 100644 --- a/giraph-core/src/main/java/org/apache/giraph/edge/HashMultimapEdges.java +++ b/giraph-core/src/main/java/org/apache/giraph/edge/HashMultimapEdges.java @@ -20,7 +20,6 @@ package org.apache.giraph.edge; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.UnmodifiableIterator; -import org.apache.giraph.conf.DefaultImmutableClassesGiraphConfigurable; import org.apache.hadoop.io.Writable; import org.apache.hadoop.io.WritableComparable; @@ -41,7 +40,7 @@ import java.util.Map; * @param <E> Edge value */ public class HashMultimapEdges<I extends WritableComparable, E extends Writable> - extends DefaultImmutableClassesGiraphConfigurable<I, Writable, E, Writable> + extends ConfigurableVertexEdges<I, E> implements MultiRandomAccessVertexEdges<I, E> { /** Multimap from target vertex id to edge values. */ private ArrayListMultimap<I, E> edgeMultimap;
