Coverage Report - org.apache.giraph.graph.partition.RangePartitionOwner
 
Classes in this File Line Coverage Branch Coverage Complexity
RangePartitionOwner
0%
0/12
N/A
1
 
 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.partition;
 20  
 
 21  
 import java.io.DataInput;
 22  
 import java.io.DataOutput;
 23  
 import java.io.IOException;
 24  
 
 25  
 import org.apache.giraph.graph.BspUtils;
 26  
 import org.apache.hadoop.io.WritableComparable;
 27  
 
 28  
 /**
 29  
  * Added the max key index in to the {@link PartitionOwner}.  Also can provide
 30  
  * a split hint if desired.
 31  
  *
 32  
  * @param <I> Vertex index type
 33  
  */
 34  
 @SuppressWarnings("rawtypes")
 35  
 public class RangePartitionOwner<I extends WritableComparable>
 36  
     extends BasicPartitionOwner {
 37  
   /** Max index for this partition */
 38  
   private I maxIndex;
 39  
 
 40  
   /**
 41  
    * Default constructor.
 42  
    */
 43  0
   public RangePartitionOwner() { }
 44  
 
 45  
   /**
 46  
    * Constructor with the max index.
 47  
    *
 48  
    * @param maxIndex Max index of this partition.
 49  
    */
 50  0
   public RangePartitionOwner(I maxIndex) {
 51  0
     this.maxIndex = maxIndex;
 52  0
   }
 53  
 
 54  
   /**
 55  
    * Get the maximum index of this partition owner.
 56  
    *
 57  
    * @return Maximum index.
 58  
    */
 59  
   public I getMaxIndex() {
 60  0
     return maxIndex;
 61  
   }
 62  
 
 63  
   @Override
 64  
   public void readFields(DataInput input) throws IOException {
 65  0
     super.readFields(input);
 66  0
     maxIndex = BspUtils.<I>createVertexId(getConf());
 67  0
     maxIndex.readFields(input);
 68  0
   }
 69  
 
 70  
   @Override
 71  
   public void write(DataOutput output) throws IOException {
 72  0
     super.write(output);
 73  0
     maxIndex.write(output);
 74  0
   }
 75  
 }