1/*2 * Licensed to the Apache Software Foundation (ASF) under one3 * or more contributor license agreements. See the NOTICE file4 * distributed with this work for additional information5 * regarding copyright ownership. The ASF licenses this file6 * to you under the Apache License, Version 2.0 (the7 * "License"); you may not use this file except in compliance8 * with the License. You may obtain a copy of the License at9 *10 * http://www.apache.org/licenses/LICENSE-2.011 *12 * Unless required by applicable law or agreed to in writing, software13 * distributed under the License is distributed on an "AS IS" BASIS,14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.15 * See the License for the specific language governing permissions and16 * limitations under the License.17 */1819package org.apache.giraph.edge;
2021import org.apache.hadoop.io.Writable;
22import org.apache.hadoop.io.WritableComparable;
2324/**25 * A complete edge, the target vertex and the edge value. Can only be one26 * edge with a destination vertex id per edge map.27 *28 * @param <I> Vertex index29 * @param <E> Edge value30 */31 @SuppressWarnings("rawtypes")
32publicclass DefaultEdge<I extends WritableComparable, E extends Writable>
33implements ReusableEdge<I, E> {
34/** Target vertex id */35private I targetVertexId = null;
36/**Edge value */37private E value = null;
3839/**40 * Constructor for reflection41 */42publicDefaultEdge() { }
4344/**45 * Create the edge with final values. Don't call, use EdgeFactory instead.46 *47 * @param targetVertexId Desination vertex id.48 * @param value Value of the edge.49 */50protectedDefaultEdge(I targetVertexId, E value) {
51this.targetVertexId = targetVertexId;
52this.value = value;
53 }
5455 @Override
56public I getTargetVertexId() {
57return targetVertexId;
58 }
5960 @Override
61public E getValue() {
62return value;
63 }
6465 @Override
66publicvoid setTargetVertexId(I targetVertexId) {
67this.targetVertexId = targetVertexId;
68 }
6970 @Override
71publicvoid setValue(E value) {
72this.value = value;
73 }
7475 @Override
76public String toString() {
77return"(targetVertexId = " + targetVertexId + ", " +
78"value = " + value + ")";
79 }
80 }