Coverage Report - org.apache.giraph.graph.VertexEdgeCount
 
Classes in this File Line Coverage Branch Coverage Complexity
VertexEdgeCount
0%
0/19
0%
0/2
1.125
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one
 3  
  * or more contributor license agreements.  See the NOTICE file
 4  
  * distributed with this work for additional information
 5  
  * regarding copyright ownership.  The ASF licenses this file
 6  
  * to you under the Apache License, Version 2.0 (the
 7  
  * "License"); you may not use this file except in compliance
 8  
  * with the License.  You may obtain a copy of the License at
 9  
  *
 10  
  *     http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing, software
 13  
  * 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 and
 16  
  * limitations under the License.
 17  
  */
 18  
 
 19  
 package org.apache.giraph.graph;
 20  
 
 21  
 /**
 22  
  * Simple immutable structure for storing a final vertex and edge count.
 23  
  */
 24  
 public class VertexEdgeCount {
 25  
   /** Immutable vertices */
 26  
   private final long vertexCount;
 27  
   /** Immutable edges */
 28  
   private final long edgeCount;
 29  
   /** Immutable mappings */
 30  
   private final long mappingCount;
 31  
 
 32  
   /**
 33  
    * Default constructor.
 34  
    */
 35  0
   public VertexEdgeCount() {
 36  0
     vertexCount = 0;
 37  0
     edgeCount = 0;
 38  0
     mappingCount = 0;
 39  0
   }
 40  
 
 41  
   /**
 42  
    * Constructor with initial values.
 43  
    *
 44  
    * @param vertexCount Final number of vertices.
 45  
    * @param edgeCount Final number of edges.
 46  
    * @param mappingCount Final number of mappings.
 47  
    */
 48  0
   public VertexEdgeCount(long vertexCount, long edgeCount, long mappingCount) {
 49  0
     this.vertexCount = vertexCount;
 50  0
     this.edgeCount = edgeCount;
 51  0
     this.mappingCount = mappingCount;
 52  0
   }
 53  
 
 54  
   public long getVertexCount() {
 55  0
     return vertexCount;
 56  
   }
 57  
 
 58  
   public long getEdgeCount() {
 59  0
     return edgeCount;
 60  
   }
 61  
 
 62  
   public long getMappingCount() {
 63  0
     return mappingCount;
 64  
   }
 65  
 
 66  
   /**
 67  
    * Increment the both the vertex edge count with a {@link VertexEdgeCount}.
 68  
    *
 69  
    * @param vertexEdgeCount add both the vertices and edges of this object.
 70  
    * @return New immutable object with the new vertex and edge counts.
 71  
    */
 72  
   public VertexEdgeCount incrVertexEdgeCount(
 73  
       VertexEdgeCount vertexEdgeCount) {
 74  0
     return new VertexEdgeCount(
 75  0
         vertexCount + vertexEdgeCount.getVertexCount(),
 76  0
         edgeCount + vertexEdgeCount.getEdgeCount(),
 77  0
         mappingCount + vertexEdgeCount.getMappingCount());
 78  
   }
 79  
 
 80  
   /**
 81  
    * Increment the both the vertex edge count with primitives.
 82  
    *
 83  
    * @param vertexCount Add this many vertices.
 84  
    * @param edgeCount Add this many edges.
 85  
    * @return New immutable object with the new vertex and edge counts.
 86  
    */
 87  
   public VertexEdgeCount incrVertexEdgeCount(
 88  
       long vertexCount, long edgeCount) {
 89  0
     return new VertexEdgeCount(
 90  
         this.vertexCount + vertexCount,
 91  
         this.edgeCount + edgeCount,
 92  
         this.mappingCount + mappingCount);
 93  
   }
 94  
 
 95  
   @Override
 96  
   public String toString() {
 97  0
     return "(v=" + getVertexCount() + ", e=" + getEdgeCount() +
 98  
         (mappingCount > 0 ? ", m=" + mappingCount : "") + ")";
 99  
   }
 100  
 }