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.graph;
2021import org.apache.hadoop.mapreduce.Mapper;
2223/**24 * Immutable global state of the graph.25 */26publicclassGraphState {
27/** Graph-wide superstep */28privatefinallong superstep;
29/** Graph-wide number of vertices */30privatefinallong numVertices;
31/** Graph-wide number of edges */32privatefinallong numEdges;
33/** Graph-wide map context */34privatefinal Mapper<?, ?, ?, ?>.Context context;
3536/**37 * Constructor38 *39 * @param superstep Current superstep40 * @param numVertices Current graph-wide vertices41 * @param numEdges Current graph-wide edges42 * @param context Context43 *44 */45publicGraphState(long superstep, long numVertices, long numEdges,
46 Mapper<?, ?, ?, ?>.Context context) {
47this.superstep = superstep;
48this.numVertices = numVertices;
49this.numEdges = numEdges;
50this.context = context;
51 }
5253publiclong getSuperstep() {
54return superstep;
55 }
5657publiclong getTotalNumVertices() {
58return numVertices;
59 }
6061publiclong getTotalNumEdges() {
62return numEdges;
63 }
6465public Mapper.Context getContext() {
66return context;
67 }
6869 @Override
70public String toString() {
71return"(superstep=" + superstep + ",numVertices=" + numVertices + "," +
72"numEdges=" + numEdges + ",context=" + context + ")";
73 }
74 }